[H-GEN] time in C/C++

Raymond Smith raymonds at uq.net.au
Tue Dec 28 19:22:54 EST 1999


[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics.  Please observe the list's charter.          ]

On Tue, 28 Dec 1999, Frank Brand wrote:
> The divisor is 86,400 if you want to convert to days - time_t results
> in seconds and there are 86,400 in a day.
[...] 
> I recall reading a text that said that there may be some inaccuracies
> in UNIX and it would be better to write your own function (don't
> exactly know why but that is what was said).

I believe there are some problems with leap seconds in UTC and the
calendar, which does not believe in leap seconds. Although I suspect that
the difference is neither here nor there over short periods of less than a
year.

A good source for Date/Time functions is the Date::Calc and Date::Manip
Perl modules from cpan. One of these modules is built on top of a C
library that provides accurate date/time operations for the Gregorian
Calendar along with conversions to and from time_ts.

However, for your purposes, I suspect that time_t will be enough. I'd only
really worry if there was a need to keep this information for record
keeping purposes. 

Cheers,

Raymond

---
raymond at humbug.org.au                     All that we see, or seem,
                                    Is but a dream, within a dream.


--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.



More information about the General mailing list