Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

See a possible Y2K bug in shutdown UNIX
At least, I think this is a Y2K problem with shutdown. Reader David P. wrote:
Ouch, I have been bit by the millennium bug. I typed in the terminal:
sudo shutdown -h 0308210940
Password:
and got as a response
Shutdown at Fri Aug 21 08:40:00 1903.
According the the shutdown man page, the time field is defined as:
Time is the time at which shutdown will bring the system down and may be the word now (indicating an immediate shutdown) or specify a future time in one of two formats: +number, or yymmddhhmm, where the year, month, and day may be defaulted to the current system values. The first form brings the system down in number minutes and the second at the absolute time specified.
I tested this myself on two machines (both running 10.2.6), and got the same results as David. Some friends who should know tell me that it's been fixed in Panther, but I'm not aware of a workaround in 10.2 other than using the -h some_number option, where some_number is the number of minutes until shutdown.

Can someone else confirm this issue (are we both doing something wrong?), and/or provide any other workarounds?
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[5,324 views]  

See a possible Y2K bug in shutdown | 16 comments | Create New Account
Click here to return to the 'See a possible Y2K bug in shutdown' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
See a possible Y2K bug in shutdown
Authored by: Cap'n Hector on Sep 02, '03 10:50:17AM

Works fine in 10.3.

I get the same behaviour in 10.2, however.



[ Reply to This | # ]
Here is what is happening
Authored by: msbrown on Sep 02, '03 03:21:16PM

This is a UNIX thing. UNIX stores the time internally as a (usually)
signed integer (time_t). This means 31 bits' worth of seconds starting
from the UNIX epoch [0000 GMT 1 Jan 1970]. The last possible valid
date by this reference is

19 January 2038 03:14:07 UCT

OS X 10.3, being made ready for future 64-bit systems, may now be
storing time_t in a 64-bit int.



[ Reply to This | # ]
See a possible Y2K bug in shutdown
Authored by: greggo on Sep 02, '03 11:12:59AM

The UNIX date is read in seconds from 1/1/1970. The date you are using "0308210940" converts to "Monday, October 8, 1979 1:09:00 AM" according to this web page...

http://dan.drydog.com/unixdatetime.html

There is an option to set the the date to the current date on the above page. The decimal equivalent of todays date is "1062514999". I'm not sure why 1903 is coming up.



[ Reply to This | # ]
The Mac epoch is different
Authored by: grrl_geek on Sep 02, '03 11:30:30AM

I believe the Mac epoch (time "0") --- at least traditionally --- is in 1904, whereas the Unix one is 1970.

---
~~~~~~~~~~~~~
Sinker sucker socks pants, apocryphal awry!



[ Reply to This | # ]
The Mac epoch is different
Authored by: srowen on Sep 02, '03 02:12:46PM

The epoch used by the classic Mac OS was indeed based on a start date in 1904, but OS X's BSD roots mean that its epoch, when it comes up, is the usual 1970 one seen in Unix variants.

Either way this is not the heart of the issue the poster found with shutdown.



[ Reply to This | # ]
See a possible Y2K bug in shutdown
Authored by: z123 on Sep 02, '03 11:57:04AM

If you'll notice, the time it was set to shutdown was correct *except* for the year. It is not asking for UNIX time; simply a bug in shutdown.



[ Reply to This | # ]
See a possible Y2K bug in shutdown
Authored by: srowen on Sep 02, '03 02:09:59PM

The input is not interpreted as a number of seconds since the epoch -- see the man page excerpt quoted in the original post:

"... specify a future time in one of two formats: +number, or yymmddhhmm ..."

The issue is that year is specified with only two digits.



[ Reply to This | # ]
See a possible Y2K bug in shutdown
Authored by: greggo on Sep 02, '03 02:28:37PM

Sorry all, it looked like a unix date when I first read the post this morning (no coffee yet). I read the man shutdown page and seen that the date is in the correct format.



[ Reply to This | # ]
See a possible Y2K bug in shutdown
Authored by: ctparker333 on Sep 02, '03 06:28:42PM
Someone may have already pointed this out, but this comand works as long as you do not specify a year. If you use time code 09030940, it is interpreted as 9:40, Sep 3, 2003. The default year (current year) is used when the user does not specify it.

"two formats: +number, or yymmddhhmm, where the year, month, and day may be defaulted to the current system values."

Of course, there is still a problem if you want to shutdown in a year other than the current year.

Good luck

[ Reply to This | # ]
See a possible Y2K bug in shutdown
Authored by: Cerberus on Sep 02, '03 10:33:55PM
Please read the man page again. It says:
may be the word 'now' (indicating an immediate shutdown) or specify a future time in one of two formats: +number, or yymmddhhmm, where the year, month, and day may be defaulted to the current system values.
a little slower now... specify a future time... The orig post was on 9/2 but the command attempted to set a reboot for 8/31. I would therefore see this as a display bug in dealing with a date which is already in the past... As Rob stated, it might be fixed in 10.3 but then I would like to get clarification: What is 'fixed/different about this in 10.3? Does it change the command line to be in the future? Does it ignore it and not process the command?

Inquiring minds (and comprehending ones) want to know!

[ Reply to This | # ]

See a possible Y2K bug in shutdown
Authored by: ctparker333 on Sep 03, '03 01:14:14AM

The problem is that, using 10.2, if you try to use the shutdown command to shut down computer in the future, and you use the full time code (10 digits), the first 2 digits are read as the year. However if you set the first two digits as 03, the output has the year as 1903, not 2003. The trick is to only use 8 digits, then the computer uses to the current year.

I haven't played with 10.3 yet so I don't know what is different.



[ Reply to This | # ]
See a possible Y2K bug in shutdown
Authored by: aranor on Sep 03, '03 01:17:21AM

That's not the issue. I would bet that the original poster tried it as a future date, but the date became in the past by the time this was actually posted.



[ Reply to This | # ]
See a possible Y2K bug in shutdown
Authored by: JayBee on Sep 03, '03 04:39:09AM

I love the way that Y2K bugs are now noticed as intellectual curios...

Ah, the wonders of hindsight :)



[ Reply to This | # ]
See a possible Y2K bug in shutdown
Authored by: Pluto on Sep 03, '03 06:07:19AM

I'm Looking into the Y3K bug.... Wait while I visit the CopyWrite Office :D



[ Reply to This | # ]
See a possible Y2K bug in shutdown
Authored by: iMMersE on Sep 05, '03 07:41:04AM

Copyright ...

---
www.blogim.com/blog/carl - I'm interesting, I am.



[ Reply to This | # ]
See a possible Y2K bug in shutdown
Authored by: Anidel on Sep 08, '03 05:26:04PM

It's also strange that it changes the time too!!
You specified 9:40 it says 8:40!

Anidel

---
Anidel



[ Reply to This | # ]