Timeline for Convert length of time to appropriate unit
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 31, 2016 at 6:52 | comment | added | mdfst13 | @DavidWallace In every four hundred year period, regardless of start date, there are exactly 146,097 days. That includes 97 leap days. In a scope measuring millions and billions of years, this will produce an error of just under a year for every 1500 years. That's an error of over 600 years at a million. And I'm not sure why you feel that consistently overestimating the number of years is better than estimating on average. Any eight year or more period will be wrong in the original method, as there is always at least one leap year in any eight year period. | |
Aug 31, 2016 at 1:45 | comment | added | Dawood ibn Kareem | ... shows calculations involving only the number of milliseconds - so this level of accuracy is impossible. In particular, your code can display "365 days" with the right argument. It seems clear from OP's original code that that's not what's required. | |
Aug 31, 2016 at 1:44 | comment | added | Dawood ibn Kareem | No, there are NOT 365.2425 days in a year. There are 365 days in some years, and 366 days in others. To be able to deal with this "correctly", we'd need more information than just the number of milliseconds. For example, for 730 days worth of milliseconds, this could be expected to output "1 year", because it's less than two years if one is a leap year; or it could be expected to output "2 years" if both years happen to be normal years. Therefore, we'd need a method which takes both the number of milliseconds and a "start date" as parameters. But OP doesn't want this. The question ... | |
Aug 30, 2016 at 23:39 | comment | added | Jake Stanger | I didn't mention because I didn't really think it would be particularly important, but this is for a game mod, so the day/night cycle is a fixed period of time (and dead accuracy isn't important, it's mostly for show...). Months require more work than they're worth (the number of days vary) and I figured people are capable of interpreting "234 days" or whatever. The latter point also applies to decades/centuries/millenia. I will bear the variable comments in mind though. | |
Aug 30, 2016 at 23:25 | history | answered | mdfst13 | CC BY-SA 3.0 |