2133RE: [ISO8601] The challenge
- Jun 22, 2007
Thanks for this. I think the answer is to become more Babbage then Newton . Whereas calculus is effective for some calculations, the digital, mechanical counting mechanisms of the census are much more suitable to event math.
It’s a little bit like doing Fourier transforms to use frequencies where they are more efficient and then converting back to spatial dimensions for the end results.
Personally, I think it is a mistake to use names like addMonth, AddYear, because the number of seconds you need to add depends on the start value and the number of months or years etc. to be added (or subtracted if negative).
Instead I would think of it as NextMonthlyAnniversary, NextAnniversary, NextWeeklyAnniversary, etc. (“Anniversary” is generalized and not used in the sense of an annual occurrence.)
So Next month, adds one to the month field which can represent a variable number of seconds of actual time units, since it can be a 28, 29, 30, or 31 day month, it might include a leap second, a change to/from daylight savings, etc.
If the month value exceeds the maximum (12) then of course it wraps to 1 and the year must be upped.
Once you generate the intended anniversary you can convert it to the number of seconds since the time epoch and calculate the actual number of seconds greater than the start event.
Maybe a better analogy than the fourier transform is to consider flying across the surface of the spherical earth.
You can travel 1 mile south and 1 mile west and 1 mile north, and depending whether your starting point is the north pole or not, you can end up at the same or a different point from the origin.
- << Previous post in topic Next post in topic >>