Hi,

An alternative to POSIXct is integer time :

12:34:56.789  =>  123456789L

which I do quite a bit. And integer dates: 26 Mar 2013 => 20130326L.

You can get quite far with two integer columns: date and time. Quite often I don't use any DateTime class at all. Each column is 4 bytes and `roll=TRUE` then only rolls within the same day which is what I usually want.

But, yes ITime should be in milliseconds. I couldn't find this on the tracker so have now filed it here : https://r-forge.r-project.org/tracker/index.php?func=detail&aid=2644&group_id=240&atid=978 If any links to posts or S.O. questions are not reachable from there, please add.

For micro (and nanosecond, why not) then perhaps we could use integer64 to avoid any floating point issues.

24*60*60*1e9 * 365*100  ==  3.15e18

which fits in 2^63 (9.2e18), if I've got the arithmetic right. The nano timestamp could be +/- 292 years of precise nanoseconds around the epoch.

And/or, for time only with no date, it could go to picoseconds : 24*60*60*1e12 = 8.6e16 < 2^63

All that would be required is availability of integer64, which is pretty standard (even on 32bit machines).

Matthew


On 23.03.2013 07:06, gaizoule wrote:
Hi, everyone,
data.table is really a fantastic package, I have become accustomed to using
it and saved a lot of time.
In my daily work, I need to analysis lots of tick data, the IDateTime is very useful for me. However, ITime class can not handle Millisecond. I suggest using the numbers of milliseconds to represents the introday time, for example, for time "11:00:00.000", using integer 11 * 60 * 60 * 1000 to represent it. I have used kdb+/q , kdb+/q just do with time by that
way.

best regards,

gaizoule




--
View this message in context:

http://r.789695.n4.nabble.com/Suggestion-on-ITime-class-implementing-tp4662281.html
Sent from the datatable-help mailing list archive at Nabble.com.
_______________________________________________
datatable-help mailing list
[email protected]

https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to