James Kanze said:
Where? I'd always believed that it was implementation defined,
but that time_t was required to contain seconds from some epoch,
but I can't find even that in the on line copy of the Posix
standard.
I'm looking atwww.opengroup.org.
That's my usual source too.
The definition of time_t isn't very specific,
That's putting it mildly

.
but the definition of
the time() function says it returns "the value of time in seconds
since the Epoch".
So my next question is why this page didn't turn up when I
searched for "epoch" or "Epoch" at the site

. The only page
which did show up was mktime, and that speaks of an "encoding"
for time_t.
My impression is that Posix is rather ambiguous here. I do wish
it would say somewhere that whatever the type, the actual
numeric value in the time_t is the seconds from the epoch.
That's sort of implicit in things like the above---otherwise,
what does "the value of time in seconds since the Epoch" mean?
But if that's the case, why don't the requirements for time_t
say so, and why does the specification of mktime use language
like "with the same encoding as that of the values returned by
time()"?
The "Epoch" is defined as "The time zero hours,
zero minutes, zero seconds, on January 1, 1970 Coordinated Universal
Time (UTC)."
(I think that UTC wasn't defined until some time after 1970, but I
suppose its definition can be applied retroactively.)
It's a different issue, but §4.14 definitly says it is NOT UTC.
In particular, a Posix conformant implementation is required to
ignore leap seconds (except, of course, that there are no fixed
requirements on the accuracy of the clock, so presumably, a
Posix conformant implementation could arrange things so the
clock "just happened" to be off by the amount necessary to take
into account leap seconds).
But time_t can be either an integer type (either signed or
unsigned) or a floating-point type.
But if I take the difference between two type_t, I'll get a
type_t with the number of seconds between the two times. That,
at least, is what I'm looking for; I've always assumed that this
works in a Posix conformant environment (and under more recent
Windows), but I'm have great difficulty finding such a guarantee
in the standard.
To maintain some topicality for comp.lang.c, I'll mention (yet
again) that these requirements go beyond what's required by
the C standard.
Definitly.