Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
stime-1.0.tar.gz | 2012-07-26 | 349.1 kB | |
README | 2012-07-26 | 2.6 kB | |
Totals: 2 Items | 351.7 kB | 0 |
$Id$ STime is intended to be a simple and lightweight set of date and time functions with reasonable performance. Principal design goals: - support arbitrary, user-defined epochs. - times wrt to different epochs should be different types. - comparisons between dates should be exact and predictable. - conversions between times wrt different epochs should be easy. - provide a wide range of usable dates and times. - support negative times, ie times before the epoch. - avoid unnecessary complications such as time zones and daylight savings time corrections. (But such corrections are easy to do for those so inclined.) - bounded intervals including intersection and union functions. - a complete set of arithmetic and relational operators. - a useful degree of compatibility with ISO 8601, which specifies how times and dates should be written. Limitations: - does not support leap seconds or conversion between GPS time and UTC. - uses the proleptic Gregorian calendar. Ie, assumes that the Gregorian calendar has been in use since the Julian epoch, which is not the case. - for Microsoft users, the library is implemented in unmanaged C++. I chose the Julian epoch, 0 hours 1 January 4713 BC, as the fundamental epoch. I chose this in order to get a wide range of usable dates and also because easy and efficient conversion algorithms are available (see stime.h). All other epochs are defined as offsets from this one. I do not claim that STime is "high performance". It suits me, YMMV. STime can accept ISO formatted date strings for some functions. It is not ISO 8601 compliant; a future version might be. STime is written in C++. I originally developed it on Linux, but I have ported it without much effort to Microsoft platforms. The Boost libraries are required. The distribution (after compiling and installing) contains the header files stime.h and stime.hpp and a shared (or static) library. There are several test drivers in the test directory which serve as examples of how to use the library, see esp. stime_test.cpp. Building STime. For debug builds, pass CXXFLAGS='-g -O0' to configure. For release builds use CXXFLAGS='-O2'. The default is '-g -O2' which I find useless. To debug one of the test drivers, invoke the debugger under libtool as follows: libtool --mode=execute gdb <driver wrapper script> (or use ddd). Executing the debugger directly causes problems when stepping into the STime shared library. It appears that the library has been optimized. Executing under libtool makes the debugger work as expected.