NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

number of seconds since the epoch

(I am not subscribed to this list, so please cc me in replies.)

In NetBSD using C, is there a nice way to get the number of seconds
that have elapsed since 1970-01-01T00:00:00Z?

Strictly speaking, there was no such time, since the modern definition
of UTC didn't begin until 1972.  However, I'll be happy with an answer
that is 63072000 greater than the number of seconds that have elapsed
since 1972-01-01T00:00:00Z, which was the start of modern UTC.  I'll
also be happy with an answer that is off a little because of hardware
clock drift or because of Newtonian approximations of the universe
during high-speed circumnavigation of the planet.

What I shall be very unhappy with is an answer that is off by 24 as of

I shall also be unhappy if I get the same (integral part of an) answer
when I ask at the beginning and end of a time interval greater than
one second in duration, assuming a reasonable hardware clock and that
nobody is messing with adjtime, settimeofday, &c.  This rules out
simply using posix2time(time(0)).

Home | Main Index | Thread Index | Old Index