Talk:Unix time/Archives/2013
Appearance
![]() | This is an archive of past discussions about Unix time. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page. |
Is Unix time really an integer?
The section "Encoding time as a number" begins "Unix time is a single signed integer number...", but then proceeds to show "Unix time" values (like in the tables below) that are not integers. I realize a time_t is an integer, but is "Unix time" -- in the sense of time-keeping -- really an integer? My understanding is that Unix time is at heart a continuous variable, with discrete representations possible at various levels of precision -- integer, double, long double, etc. But I'm not a time geek, so maybe someone can enlighten me. — Preceding unsigned comment added by DKMell (talk • contribs) 18:09, 9 May 2013 (UTC)
- ISO C defines type
time_t
to be an arithmetic type (only). POSIX and Unix have always definedtime_t
more specifically to be one of the signed integer types, usuallyint
orlong
. The tables show values with fractional seconds to illustrate how leap seconds are handled by systems utilizing real-time clocks with sub-second precision; the actualtime_t
values are still implemented as integer types. — Loadmaster (talk) 00:05, 22 May 2013 (UTC)
- And most UN*Xes also have calls that fill in structures containing Unix time (usually represented as
time_t
) and fractions of a section, such asgettimeofday()
, which fills in astruct timeval
that hastv_sec
andtv_usec
fields, the former being seconds since the Epoch and the latter being microseconds since that second. That's still not continuous, though, it just has finer resolution. Guy Harris (talk) 00:47, 22 May 2013 (UTC)
- And most UN*Xes also have calls that fill in structures containing Unix time (usually represented as