??? 09/06/12 11:21 Read: times |
#188252 - No - multiplier should not be 366 Responding to: ???'s previous message |
No, the multiplier should not be 366. If playing with floating point and setting a suitable year zero, it should be 365.2425 since that is the result of:
365 (the standard year) + 0.25 (1/4 = normal leap year rule) - 0.01 (1/100 = centuries are not leap years) + 0.0025 (1/400 = 1600, 2000, 2400, ... are centuries but still leap years) In this case, there is an add for the 1/4 rule. When the algorithm don't need to support as early as year 1900 or as late as 2100, then the 1/100 and 1/400 rules can be removed giving simpler code in an embedded product (while introducing a "y2k" error). So the simplification then is a multiplier of 365 (the best we can do with integers) and a check how many 4-year cycles extra to compensate for the 366th day of the leap years. The difference compared to the standard Unix implementation (if we ignore the covered range) is that the Unix functions represents the current year as 112 since the tm.tm_year field is set to year-1900. |
Topic | Author | Date |
Error in conversion from Unix EPOCH | 01/01/70 00:00 | |
zero | 01/01/70 00:00 | |
DMonth[month-1] ???? | 01/01/70 00:00 | |
Stefan is correct and... | 01/01/70 00:00 | |
+4 - 100 + 400 | 01/01/70 00:00 | |
right, but... | 01/01/70 00:00 | |
88 years is a long time | 01/01/70 00:00 | |
That is what they said in the 60's | 01/01/70 00:00 | |
Thanks. Problem solved | 01/01/70 00:00 | |
Cross-checking important | 01/01/70 00:00 | |
Just a foot note about the year | 01/01/70 00:00 | |
?back conversion | 01/01/70 00:00 | |
No - multiplier should not be 366 | 01/01/70 00:00 | |
Running out of seconds > 1970 | 01/01/70 00:00 | |
signed is actually common - to support dates before 1970 | 01/01/70 00:00 | |
Will You Now. | 01/01/70 00:00 | |
Have you considered leap seconds? | 01/01/70 00:00 | |
Leap seconds can almost always be ignored | 01/01/70 00:00 | |
Time is passing anyway or is it just an illusion? | 01/01/70 00:00 | |
Missiles? Leap seconds contra way larger drift... | 01/01/70 00:00 | |
No such thing as a free lunch! | 01/01/70 00:00 | |
Link? | 01/01/70 00:00 |