[hdf-forum] time data
Ger van Diepen
diepen at astron.nl
Tue Jun 16 21:48:52 EDT 2009
To easily manipulate with dates/times (e.g. subtract from each other) it is easiest to convert them to numbers. Leapyears are always a bit nasty to handle.
You have to have some reference date though (like Unix counts from 1-Jan-1970).
An important question is the time span you think it will be used for.
You could use an 8-byte floating point counting seconds from 1-Jan-2020 on. This has an accuracy of 17 digits.
So for a 20 year time span, you have 10 years of positive and negative values. 10 years is 315360000 seconds, so you have about 8 digits left for decimal seconds. Seems enough for your case, but it's up to you.
For our astronomical work we use the ModifiedJulianDate as 8-byte floating point. A class takes care of all arithmetic and so involved with it.
Another option is to use two long integer values (for seconds and nanoseconds), but the arithmetic will require a bit more work.
BTW Ho do you deal with Daylight Saving Time? Or do you record all times in UTC?
Cheers,
Ger
>>> Mag Gam <magawake at gmail.com> 06/17/09 3:17 AM >>>
The resolution should be the same.
The accuracy should be very high...
For instance: 43.33245-43.33242
12:33:43.33245 minus 12:33:43.33242 should equal .00003
Thanks again for the response...
On Tue, Jun 16, 2009 at 8:22 AM, Ray Burkholder<ray at oneunified.net> wrote:
> what resolution/accuracy do you need?
>
>> -----Original Message-----
>> From: Mag Gam [mailto:magawake at gmail.com]
>> Sent: Tuesday, June 16, 2009 08:27
>> To: hdf-forum at hdfgroup.org
>> Subject: [hdf-forum] time data
>>
>> If I would like to store time series data in the x column, what is the
>> best data type to use?
>>
>> My data looks like this:
>>
>> 2009-10-10 12:33:43.33242
>> 2009-10-10 12:33:43.33245
>> 2009-10-10 12:33:43.63433
>> 2009-10-10 12:33:43.73242
>> 2009-10-10 12:33:43.83242
>> 2009-10-10 12:33:43.93242
>> 2009-10-10 12:33:43.99443
>> 2009-10-10 12:33:44.43242
>>
>> Any thoughts?
>>
>> TIA
>>
>> ----------------------------------------------------------------------
>> This mailing list is for HDF software users discussion.
>> To subscribe to this list, send a message to hdf-forum-
>> subscribe at hdfgroup.org.
>> To unsubscribe, send a message to hdf-forum-unsubscribe at hdfgroup.org.
>>
>>
>> --
>> Scanned for viruses and dangerous content at
>> http://www.oneunified.net and is believed to be clean.
>>
>>
>> No virus found in this incoming message.
>> Checked by AVG - www.avg.com
>> Version: 8.5.339 / Virus Database: 270.12.63/2169 - Release Date:
>> 06/15/09 17:54:00
>
>
> --
> Scanned for viruses and dangerous content at
> http://www.oneunified.net and is believed to be clean.
>
>
----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe at hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe at hdfgroup.org.
----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe at hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe at hdfgroup.org.
More information about the Hdf-forum
mailing list