Live data from Hacker News

GitHub search for 84600 seconds. Oops.

github.com

61–64 of 64 posts

Re: GitHub search for 84600 seconds. Oops.

#62
post #4

Haha, should be 86400, not 84600.

Except it shouldn't, because when you have a leap second occur, suddenly you're off by a second. A day is a day, it's not 86400 seconds.

Most operating systems and frameworks don't expose the concept of leap seconds to user code. For example, Unix time is the number of seconds since the epoch ignoring leap seconds, so a program that compares timestamps generated by time() would be correct in assuming that a day is 86400 units of time_t.

Re: GitHub search for 84600 seconds. Oops.

#63
This should never be entered like that. Not only it's prone to typos, it also requires a comment to accompany it. Since just about every compiler/interpreter folds constants, one should write it as 60 * 60 * 24 which would run without a performance hit.

Re: GitHub search for 84600 seconds. Oops.

#64
post #60
post #59

Easy mnemonic: 60 * 60 * 24 = 864e2 (scientific notation). Take down 2 each time, and shove an e.

Easier mnemonic: 60 * 60 * 24 The compiler is going to do the operation for you.

Of course. I use 864e2 to remember that it is 86400 when I do calculations on paper.
Post reply on HN