4 ms·
Interestingly, there is an error in your code: number of seconds in a year is not constant, so you might get next year before a new year. Here's a fixed version
by ingenter 12y ago
Interestingly, there is an error in your code: number of seconds in a year is not constant, so you might get next year before a new year.
Here's a fixed version: http://jsfiddle.net/r8txd/4/show/ http://jsfiddle.net/r8txd/4/show/
- shurcooL 12y agoIt's not an error, it's a design decision. I wanted the rate of time increase to be constant every year, and I wanted the time to be universal (across all timezones). I did take leap years into account by calculating the average year length in seconds. I also wanted the calculation to be simple and independent of variations in earth's rotation speed changes, etc. So yes, over a long time, it will diverge from "years" as we know them. The only reason I used years is to provide context, since most people have a feel for how long a year is. After that, everything is base 10.