Re: TimeField for duration

2010-01-21 Thread Olivier Guilyardi
On 01/21/2010 01:31 AM, Ian Kelly wrote: > In other words, all the same limitations that we already handle for > TimeFields. This looks to me like a green light to just use the > native datatypes. I wrote a simple DurationField for my own purpose, it is not meant to be included in Django as-is,

Re: TimeField for duration

2010-01-21 Thread Olivier Guilyardi
On 01/21/2010 01:31 AM, Ian Kelly wrote: > 2010/1/20 Ɓukasz Rekucki : >> 2010/1/21 Jerome Leclanche : >>> Hi Lukasz, thanks for the wrap up >>> >>> Main issue is precision. I personally very, very often work with >>> milliseconds, and I can imagine many use cases where I'd need to work >>> with mic

Re: TimeField for duration

2010-01-20 Thread Olivier Guilyardi
On 01/21/2010 12:58 AM, Jerome Leclanche wrote: > Which is exactly what I'm doing using a BigIntegerField... AFAICS you are doing this for your new DurationField. If you do so, then you should also modify the current TimeField for better precision, so that it is coherent with this DurationField. I

Re: TimeField for duration

2010-01-20 Thread Olivier Guilyardi
On 01/21/2010 12:44 AM, Jerome Leclanche wrote: > > Main issue is precision. I personally very, very often work with > milliseconds, and I can imagine many use cases where I'd need to work > with microseconds. How many of these backends do not at least support > millisecond precision? If you want

Re: TimeField for duration

2010-01-20 Thread Olivier Guilyardi
On 01/21/2010 12:14 AM, Jerome Leclanche wrote: > Keep in mind, TIME fields are for storing time, not for storing > durations. For durations, postgres has an INTERVAL field (cf ticket), > however not every database has that field type. Not in MySQL, from the official docs: "TIME values may range

Re: TimeField for duration

2010-01-20 Thread Olivier Guilyardi
On 01/20/2010 11:46 PM, Jerome Leclanche wrote: > > I've worked on a DurationField implementation (ticket: > http://code.djangoproject.com/ticket/2443). However I was extremely > displeased with the whole DecimalField backend. > With the recent addition of BigIntegerField, I am now saving duration

TimeField for duration

2010-01-20 Thread Olivier Guilyardi
Hi everyone, Django TimeField is mapped to Python datetime.time. That doesn't fit my needs since I must deal with durations, which can exceed 24h, and datetime.time can't do that. On the MySQL side, TimeField is mapped to the MySQL TIME column type, which is correct IMO: http://dev.mysql.com/doc/