[Numpy-discussion] timezones and datetime64

Francesc Alted francesc@continuum...
Thu Apr 4 09:52:36 CDT 2013


On 4/4/13 1:54 PM, Nathaniel Smith wrote:
> On Thu, Apr 4, 2013 at 12:52 AM, Chris Barker - NOAA Federal
> <chris.barker@noaa.gov> wrote:
>> Thanks all for taking an interest. I need to think a bot more about
>> the options before commenting more, but:
>>
>> while we're at it:
>>
>> It seems very odd to me that datetime64 supports different units
>> (right down to  attosecond) but not different epochs. How can it
>> possible be useful to use nanoseconds, etc, but only right around
>> 1970? For that matter, why all the units at all? I can see the need
>> for nanosecond resolution, but not without changing the epoch -- so if
>> the epoch is fixed, why bother with different units? Using days (for
>> instance) rather than seconds doesn't save memory, as we're always
>> using 64 bits. It can't be common to need more than 2.9e12 years (OK,
>> that's not quite as old as the universe, so some cosmologists may need
>> it...)
> Another reason why it might be interesting to support different epochs
> is that many timeseries (e.g., the ones I work with) aren't linked to
> absolute time, but are instead "milliseconds since we turned on the
> recording equipment". You can reasonably represent these as timedeltas
> of course, but it'd be even more elegant to be able to be able to
> represent them as absolute times against an opaque epoch. In
> particular, when you have multiple recording tracks, only those which
> were recorded against the same epoch are actually commensurable --
> trying to do
>    recording1_times[10] - recording2_times[10]
> is meaningless and should be an error.

I remember to be discussing this with some level of depth 5 years ago in 
this list, as we asked people about the convenience of including an 
user-defined 'epoch'.  We were calling it 'origin'. But apparently it 
was decided that this was not needed because timestamps+timedelta would 
be enough.  The NEP still reflects this discussion:

https://github.com/numpy/numpy/blob/master/doc/neps/datetime-proposal.rst#why-the-origin-metadata-disappeared

This is just an historical note, not that we can't change that again.

-- 
Francesc Alted



More information about the NumPy-Discussion mailing list