3 ms·
just to add to the examples here: last week i was writing code to handle calibration data from seismic detectors. these are connected to GPS receivers and so h
by andrewcooke 15y ago
just to add to the examples here: last week i was writing code to handle calibration data from seismic detectors. these are connected to GPS receivers and so have pretty accurate times. yet when i triggered a calibration it would start 1 minute in the past. somehow the receiver was moving back in time before starting the calibration....
...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.
- roel_v 15y agoboost::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.)
- exDM69 15y agoC++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.
- njl 15y agoI haven't played with it much, but the dateutil[1] package seems to do some nice stuff. [1] http://labix.org/python-dateutil http://labix.org/python-dateutil
- masklinn 15y ago> 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.
- rvkennedy 15y agoWatch out for GPS time: it ignores leap seconds, and is currently, exactly fifteen seconds ahead of UTC.
- andrewcooke 15y agothanks. 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).