

GitHub search of 84600 seconds, oops... - jacquesm
https://github.com/search?q=84600%20seconds&amp;type=Code

======
hughes

        #SECONDS_PER_23_5_HOURS = 84600
    

Well, at least someone's aware of what they're doing.

------
sp332
Posted 18 days ago, oddly :)
[https://news.ycombinator.com/item?id=7717414](https://news.ycombinator.com/item?id=7717414)

~~~
sprobertson
Looks like jacquesm has been posting a lot of duplicate links recently:
[https://news.ycombinator.com/submitted?id=jacquesm](https://news.ycombinator.com/submitted?id=jacquesm)

------
dilap
There's something fun about just typing in a large constant (and it's fun when
you start to recognize them by heart), but you're probably better off just
making it obvious by including a little arithmetic: 24 * 60 * 60.

As a nice-side effect, harder to typo. :)

------
weddpros
For those wondering: it should be 86400 instead. 60 _60_ 24 = seconds in a
day.

~~~
ColinWright
You have fallen foul of the HN formatting codes - you mean 60 * 60 * 24
seconds in a day. Or use the coding format:

    
    
        Seconds_in_a_day = 24 * 60 * 60
    

Of course, this is wrong anyway for any number of reasons, but it was the
original intent.

~~~
oneeyedpigeon
Care to provide some of those reasons?

~~~
ColinWright
Asking Google:

[https://www.google.co.uk/search?q=why+are+there+not+always+8...](https://www.google.co.uk/search?q=why+are+there+not+always+86400+seconds+in+a+day)

Here's some reading:

[http://stackoverflow.com/questions/7552104/is-a-day-
always-8...](http://stackoverflow.com/questions/7552104/is-a-day-
always-86-400-epoch-seconds-long)

[http://stackoverflow.com/questions/12516059/php-timestamp-
in...](http://stackoverflow.com/questions/12516059/php-timestamp-interval-
between-days-not-always-86400-seconds-why)

[http://en.wikipedia.org/wiki/Day](http://en.wikipedia.org/wiki/Day)

[http://justinsomnia.org/2007/03/yesterday-was-
only-82800-sec...](http://justinsomnia.org/2007/03/yesterday-was-
only-82800-seconds-long/)

~~~
oneeyedpigeon
OK, but most of the time you're not really going to care about those
exceptions, are you? Like in the example of setting a cookie for 'a day'.

~~~
ColinWright
Where you're using "day" to mean "reasonably long time in the context of
browser session" then no, it won't matter. But if you're using time stamps as
IDs in a database, recognize that the same time can occur twice as the clocks
get put back in the fall, recognize that the "seconds" field can sometimes be
more than 60, and so on. If you get into the habit of taking these shortcuts
then you are likely to get caught out if you move outside the specific domain,
and you ill be cursed as you introduce subtle and hard-to-find bugs based on
invalid assumptions.

Getting time-of-day issues right is _hard._

------
benatkin
To me 86400 is just as valid as 60 * 60 * 24. It's a useful constant and
should be known. I was able to spot the error easily.

The best way to fix errors like this is to delegate it to a library.

------
wlievens
This again?

