Talk:Unix time/Archives/2014
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. |
Definition of Unix Time
Unix Time opens with the statement: "Unix time, ... that have elapsed since midnight Coordinated Universal Time (UTC), 1 January 1970, ..." I thought midnight is 24:00 hours and therefore midnight on 1.Jan.1970 is 00:00 hours on 2.Jan.1970. Should the definition state "... elapsed since 00:00 hours on 1.Jan.1970 (ie midnight on 31.Dec.1969)..." Huon03 (talk) 12:46, 21 May 2013 (UTC)
- Although 24:00 and 00:00 are both valid ways of describing that moment in time, one is preferred. See 24-hour clock#Midnight 00:00 and 24:00. And of course we need to be consistent in our usage. --Guy Macon (talk) 14:34, 21 May 2013 (UTC)
- I agree - 24:00 on 31.Dec.1969 refers to exactly the same moment in time as 00:00 hours on 1.Jan.1970.
- But the article doesn't use 24:00 or 00:00, it refers to midnight. And 1 minute after midnight 1.Jan.1970, the time is 00:01 2.Jan.70, not 00:01 1.Jan.70.
- If it is 1 hour before midnight on 24.May.13. It is (11pm) 23:00 on 24.May.13. And 2 hours later it will be (1am) 01:00 on 25.May.13.
- Similarly 1 hour before midnight Coordinated Universal Time (UTC), 1 January 1970 is 23:00 1.Jan.70. And 2 hours later it will be 01:00 on 2.Jan.70.
- All I'm suggesting is that if the article wants to use midnight, it should refer to 31.Dec.1969, not 1.Jan.1970. 58.107.81.252 (talk) 09:56, 24 May 2013 (UTC)
- Can you provide a reference that defines "midnight" to mean (only) 24:00 of the current day? I believe it's ambiguous and can be taken either way. "Midnight of 1 Jan" could mean 00:00 1 Jan or it could mean 00:00 2 Jan. In other words, it seems equally appropriate to say that a given day begins at midnight, as to say that it ends at midnight. — Loadmaster (talk) 23:24, 24 May 2013 (UTC)
- These would be excellent questions for our Midnight article, but for this article, we should use the terminology the UNIX docs use. --Guy Macon (talk) 23:48, 24 May 2013 (UTC)
- OK, let's check various UNIX documents. The Single UNIX Specification says, in Definitions, that the Epoch is "The time zero hours, zero minutes, zero seconds, on January 1, 1970 Coordinated Universal Time (UTC)." the OS X time(3) man page says "The time() function returns the value of time in seconds since 0 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Universal Time, without including leap seconds."; other BSD-flavored OSes use the same language. The Linux time(2) man page from the Linux man-pages project (hosted at kernel.org, which at least gives it some sense of being "official") says "time() returns the time as the number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC)." The Solaris 11 time(2) man page says "The time() function returns the value of time in seconds since 00:00:00 UTC, January 1, 1970.".
- Even the V7 time(2) man page says "Time returns the time since 00:00:00 GMT, Jan. 1, 1970, measured in seconds."
- So I'd vote for removing "midnight" and replacing it with 00:00:00, as the actual UNIX docs don't seem to say "midnight". I've just made that change. Guy Harris (talk) 01:29, 25 May 2013 (UTC)
- Good solution. BTW, our "History" section says " The first edition Unix Programmer's Manual dated 3 November 1971 defines the Unix time as 'the time since 00:00:00, 1 January 1971, measured in sixtieths of a second' ". Should we add a note explaining the 1970/1971 discrepancy? Was it a typo in the docs, or was it changed along with the 1Hz change? --Guy Macon (talk) 01:56, 25 May 2013 (UTC)
- Thanks guys. Huon03 (talk) 08:29, 25 May 2013 (UTC)
- Actually, I want to thank you. That was exactly the kind of question that leads to improvements to the encyclopedia. When something is unsourced or unclear, it takes the right question to lead to it being fixed. (In your face, Britannica! <smile>) --Guy Macon (talk) 09:56, 25 May 2013 (UTC)
External reference for definition
I've added a citation-needed tag to the first 'definition' on the page since, most unexpectedly, this page doesn't point to a formal external definition of unix time. It points broadly towards the POSIX standard, but I can't find any precise definition there under 'date', 'time_t', or the entry for 'time.h'. While it's quite possible that I've missed the definition in that document, I perhaps shouldn't have to search quite so hard, and a direct citation would be useful. Even the section on Definition, which is where I'd expect to find this if not in the first paragraph, talks not about the definition, but about encoding, and about the relationship with other timescales and date formats. These topics should not, I think, be in a section called Definition, but perhaps in a separate section on Relationship to other time definitions, or something along those lines. NormanGray (talk) 09:24, 2 May 2014 (UTC)
- I've pointed to the part of the Single UNIX Specification that gives the definition (it's section 4.15 "Seconds Since the Epoch" in "General Concepts") and to the equivalent section of the Rationale. Guy Harris (talk) 17:53, 2 May 2014 (UTC)
- Those are two good references – thanks. What that means is that unix time is really not a time-scale as such, but just a representation or encoding of a date; and the mention of UTC in both the definition and the rationale is very nearly bogus. Neither smooth, continuous or single-valued – it's worse than I thought! As an editorial cum pedagogical point, I think it would be useful to have the POSIX Sect. 4.15 definition included within the article, and to break out the discussion of the relationship to other date/time representations into a separate section, but that's a non-trivial reorganisation which (I'm afraid) I'm not going to volunteer for. NormanGray (talk) 21:31, 2 May 2014 (UTC)
- And now you know why I always say that "seconds since the Epoch" shouldn't be confused with a count of the number of seconds that have elapsed since the Epoch.... Guy Harris (talk) 02:38, 3 May 2014 (UTC)