Jump to content

Talk:Unix time/Archives/2013

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by ClueBot III (talk | contribs) at 08:02, 22 May 2016 (Archiving 1 discussion from Talk:Unix time. (BOT)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)


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 (talkcontribs) 18:09, 9 May 2013 (UTC)

ISO C defines type time_t to be an arithmetic type (only). POSIX and Unix have always defined time_t more specifically to be one of the signed integer types, usually int or long. 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 actual time_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 as gettimeofday(), which fills in a struct timeval that has tv_sec and tv_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)