On 27 January 2012 00:42, Hal Murray hmur...@megapathdsl.net wrote:
I think the key idea is that there are several units of time and things like
leap seconds, time zones, and leap years make conversion between them far
from simple.
We want to work with time in units of:
SI seconds
Days
Stephen Colebourne said:
Interestingly, in JSR-310 I may end up representing a date as a packed
form of day-of-month (5 bits) and epoch-months (59 bits). Month
calculations are then easy.
Oh? When is a month from Monday coming? What day is 4 months after the last
day of next month? What about
On 27 January 2012 10:50, Clive D.W. Feather cl...@davros.org wrote:
Stephen Colebourne said:
Interestingly, in JSR-310 I may end up representing a date as a packed
form of day-of-month (5 bits) and epoch-months (59 bits). Month
calculations are then easy.
Oh? When is a month from Monday
Stephen Colebourne said:
Oh? When is a month from Monday coming? What day is 4 months after the last
day of next month? What about the antepenultimate day of next month?
Explain your working in each case.
Each of those three examples requires the day-of-week,
The first does, but only because
Clive D.W. Feather cl...@davros.org wrote:
Okay, all of those three (as amended in the first case) are of that form:
2012-01-30 + 1 month
2012-02-29 + 4 months
2012-02-27 + 4 months
and let me add:
2011-02-28 + 1 year
The usual way to deal with logic of this kind is to
Tony Finch said:
The usual way to deal with logic of this kind is to be explicit about
whether you are counting from the start or the end of the month. I don't
know if there is consensus on whether day-of-month overflows should
saturate or carry...
Indeed. Which is why it isn't easy, contrary
On 27 January 2012 13:58, Clive D.W. Feather cl...@davros.org wrote:
Stephen Colebourne said:
Oh? When is a month from Monday coming? What day is 4 months after the last
day of next month? What about the antepenultimate day of next month?
Explain your working in each case.
Each of those three
On 1/22/2012 7:42 AM, Clive D.W. Feather wrote:
#define timespecsub(vvp, uvp)\
((vvp)-tv_sec -= (uvp)-tv_sec, \
(vvp)-tv_nsec -= (uvp)-tv_nsec, \
((vvp)-tv_nsec 0)\
? ((vvp)-tv_sec--, (vvp)-tv_nsec += 10) \
: (void) 0)
Stephen Colebourne said:
OK, I mean easy in computation, you mean easy as in well-defined result.
Well, of course. Everything to do with dates is easy in computation once
you've defined what results you're after. (Well, easy in that there's
nothing strange that needs coding or corner cases to