6
Task
Constantly having to check on television, or the time on your computer to see if its 2016 is a tedious task. Being programmers, we should be able to automate this task. Write a program that will output 2016
when the system time hits Friday, January 01, 2016 00:00:00. or rather 1451624400000
ms since midnight January 1, 1970.
Input
There will be no input to your program.
Output
Your program will output 2016
to STDOUT or the equivalent when the system time hits 1451624400000
. The maximum allowed delay is 1 second or 1000
ms. If your program is started after 1451624400000
, it should not output anything (an empty string is fine) and terminate normally.
Rules
- Your code must be a full program, not just a function.
- You can assume your program will be started after midnight January 1, 1970.
- Your program should be able to detect 2016 within a second of it occurring.
- Your program should terminate after outputting
2016
. - If your program is started after midnight January 1, 2016, it should not produce any output, or an empty string, and should terminate normally.
Scoring
To keep with the trend of shortcomings in 2015, this is a code-golf challenge. The shortest code in bytes wins.
2
Many of Legen… wait for it… and Is it Christmas? solutions seems to be reusable here...
– manatwork – 2015-12-31T19:34:16.6902
I was actually looking at the Legen… wait for it… challenge. The reason I didn't consider this a duplicate is that this one is easier in that you can hard code the date you're waiting for, so that'll hope allow shortcuts in the code, and also, there isn't a guaranteed output if your code starts after
– hargasinski – 2015-12-31T19:40:16.7302016
.So when the program is run prior to 2016-01-01, it should wait until 2016 then print and exit? That is, if this were to hypothetically be run in 1986, it would have to continue to run for 30 years? – Alex A. – 2015-12-31T19:52:47.520
Yes, that's right. If it run anytime after Jan 1, 1970 and before Jan 1, 2016, it should run until midnight Jan 1, 2016, print
2016
and then exit – hargasinski – 2015-12-31T20:02:54.357