may be a small mistake in the localtime.c code
Hello, The next piece of code looks like a mistake: localtime.c (1477-1484) while (i > 0 && sp->lsis[i].ls_trans == *sp->lsis[i - 1].ls_trans + 1* && sp->lsis[i].ls_corr == sp->lsis[i - 1].ls_corr + 1) { ++hit; --i; } As far as I understand here are processed 'Leap' rules with '++' correction. If so, sp->lsis[i].ls_trans must be equal to sp->lsis[i - 1].ls_trans. BR, Igor
For (so far unused in the real word) double leap seconds, the binary file has different values for successive ls_trans/ls_corr pairs. For example, if the current "leapseconds" is changed so that the upcoming leapsecond is a double, a la... Leap 2012 Jun 30 23:59:60 ++ S ...then there will be an an entry with an ls_trans value of 1341100824 and an ls_corr value of 25 followed by an entry with an ls_trans value of 1341100825 and an ls_corr value of 26. Bottom line: Bradley White's code should be okay. --ado ________________________________________ From: Z V [igt31415926@gmail.com] Sent: Thursday, May 24, 2012 6:02 AM To: tz@iana.org Subject: [tz] may be a small mistake in the localtime.c code Hello, The next piece of code looks like a mistake: localtime.c (1477-1484) while (i > 0 && sp->lsis[i].ls_trans == sp->lsis[i - 1].ls_trans + 1 && sp->lsis[i].ls_corr == sp->lsis[i - 1].ls_corr + 1) { ++hit; --i; } As far as I understand here are processed 'Leap' rules with '++' correction. If so, sp->lsis[i].ls_trans must be equal to sp->lsis[i - 1].ls_trans. BR, Igor
Olson, Arthur David (NIH/NCI) [E] wrote:
For (so far unused in the real word) double leap seconds,
There ain't no such thing. The C standardisation committee, needing to precisely define struct tm, got misled by the fact that current procedures allow for up to two leap seconds per *year*, and mistakenly thought that the two leap seconds could occur on in the same minute. In fact the definition of UTC only allows for one leap second at a time, always at the end of a Gregorian month (so up to twelve per year, if the current preferences between months were overridden). The latest C and POSIX specs are clear that tm_sec only goes up to 60. -zefram
participants (3)
-
Olson, Arthur David (NIH/NCI) [E] -
Z V -
Zefram