Re:What every programmer should know about time
by masklinn on Monday July 04, 2011 @02:01AM
(#2725556)
> incidentally, does anyone know of a really good API for time (including calendars etc)? python's (which is largely a thin layer over C) is a horrible mess, for example.
The only date & time API I've ever seen praised is Joda (JDK/Java library). Joda's author went on to redesign it from scratch (though with inspiration from his work on Joda) for JSR-310, Java's new Date and Time API.
I haven't played with it much, but the dateutil[1] package seems to do some nice stuff.
Re:What every programmer should know about time
by rvkennedy on Monday July 04, 2011 @07:48AM
(#2726250)
Watch out for GPS time: it ignores leap seconds, and is currently, exactly fifteen seconds ahead of UTC.
Re:What every programmer should know about time
by andrewcooke on Monday July 04, 2011 @09:31AM
(#2726485)
thanks. currently everything is as insensitive to time as possible (during calibration the data are tagged, so i look for the block of tagged data near the correct time).
Re:What every programmer should know about time
by roel_v on Monday July 04, 2011 @04:20AM
(#2725818)
boost::date_time. I've cursed at it in the beginning, but it does things the Right Way, and I've been saved a number of times by its fighting back against shortcuts (like using Unix time - the issues identified in the article are real and a good summary, but the solution only works for the case where you need to work within a limited time span, from 1970 until a few decades into this century.)
Re:What every programmer should know about time
by exDM69 on Monday July 04, 2011 @01:59PM
(#2727257)
C++0x standard library is pretty nice too. std::chrono and std::thread work nicely together.
Right now I'm working with C, pthreads and struct timespec's and it makes me wish for a good time handling library.
...or ntpd on the test computer had failed and the machine was a minute fast :o) so the code to search for data now looks backwards in time as well as forwards.
incidentally, does anyone know of a really good API for time (including calendars etc)? python's (which is largely a thin layer over C) is a horrible mess, for example.