Barry Schwarz said:
While Unix may use 1970 as time 0, the standard does not require any
of the library functions to do so.
Furthermore, the representation of time is not required to be in
seconds. (For example, Excel uses a floating point value of days and
fractions thereof.)
True, though Excel's time representation presumably isn't time_t.
Probably Excel runs on a system where time_t represents seconds since
1970 (in the C implementation if not in the operating system), and it
defines its own internal type for representing dates and times. But
yes, a C implementation *could* define time_t as a floating-point type
representing days and fractions thereof.
You can compute the value you need using the difftime function.
Um, maybe. difftime() computes the difference between two time_t
values, yielding a double result. But there's no guarantee that
1900-01-01 00:00:00 can be represented as a time_t (and on many
systems it can't). For that matter, there's no guarantee that
1970-01-01 00:00:00 is within the range of time_t (though I suspect it
is under all existing implementations).
But the computation isn't difficult. It's 70 years of 365 days each,
each day being 86400 seconds (24 * 60 * 60), plus 17 leap days of
86400 seconds each (1900 was not a leap year).
I'm assuming that this "network time" uses 1900-01-01 as its epoch.
The OP just said 1900, and I've think I've heard of representations
that use 1900-03-01 or 1901-01-01 to avoid the leap year irregularity.
If the OP is referring to NTP, then yes, the epoch is 1900-01-01 (and
the representation, which uses 32 bits for the whole number of seconds
and 32-bits for the fraction, will wrap around in 2036).