Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/lib/libc/time



    Date:        Fri, 21 Oct 2022 11:54:08 -0400
    From:        Jan Schaumann <jschauma%netmeister.org@localhost>
    Message-ID:  <Y1LAoGSi+OnKZcI1%netmeister.org@localhost>

  | Right, but all that strikes me as too much to put into
  | the manual page here.

I agree, which is why I wondered if we should be giving any
details about how it is done at all.

  | I think what matters in this context is that there is
  | an order and that there is a cascading effect.

Perhaps, but

  | "This normalization is done in order from tm_sec to
  | tm_mon (inclusive), possibly leading to cascading
  | values."

As a generic order, that's backwards.   Really we need to
go from year (which is always OK) to month (which can always
be corrected simply, assuming the Gregorian calendar is in
effect, which we assume it is, even for years before that
calendar was created).   Once we know the year and month,
but not before, the day of month can be corrected (which
might then affect the month and year, but only once).

The code doesn't do it in quite that order, it does the
secs mins hours first, but doing it that way ensures that
the hours correction cannot affect the day, after it has
been corrected, the day(of month) always gets set last
(leap seconds excepted).

It really is moderately complicated - trying to explain it
at all risks being simply wrong, or so vague as to be
completely useless.    I'm not sure that what was there
before (no details at all, just (in other words) "it gets
fixed") wasn't as good as is reasonable to expect.

kre



Home | Main Index | Thread Index | Old Index