Searched hist:"4 f2073fb4c3f4490496a186153ae2fd0361e8561" (Results 1 – 1 of 1) sorted by relevance
/freebsd/sys/kern/ |
H A D | kern_tc.c | diff 4f2073fb4c3f4490496a186153ae2fd0361e8561 Wed Jun 25 23:23:51 CEST 2003 Warner Losh <imp@FreeBSD.org> Fix leap second processing by the kernel time keeping routines. Before, we would add/subtract the leap second when the system had been up for an even multiple of days, rather than at the end of the day, as a leap second is defined (at least wrt ntp). We do this by calculating the notion of UTC earlier in the loop, and passing that to get it adjusted. Any adjustments that ntp_update_second makes to this time are then transferred to boot time. We can't pass it either the boot time or the uptime because their sum is what determines when a leap second is needed. This code adds an extra assignment and two extra compare in the typical case, which is as cheap as I could made it.
I have confirmed with this code the kernel time does the correct thing for both positive and negative leap seconds. Since the ntp interface doesn't allow for +2 or -2, those cases can't be tested (and the folks in the know here say there will never be a +2s or -2s leap event, but rather two +1s or -1s leap events).
There will very likely be no leap seconds for a while, given how the earth is speeding up and slowing down, so there will be plenty of time for this fix to propigate. UT1-UTC is currently at "about -0.4s" and decrementing by .1s every 8 months or so. 6 * 8 is 48 months, or 4 years.
-stable has different code, but a similar bug that was introduced about the time of the last leap second, which is why nobody has noticed until now.
MFC After: 3 weeks Reviewed by: phk
"Furthermore, leap seconds must die." -- Cato the Elder diff 4f2073fb4c3f4490496a186153ae2fd0361e8561 Wed Jun 25 23:23:51 CEST 2003 Warner Losh <imp@FreeBSD.org> Fix leap second processing by the kernel time keeping routines. Before, we would add/subtract the leap second when the system had been up for an even multiple of days, rather than at the end of the day, as a leap second is defined (at least wrt ntp). We do this by calculating the notion of UTC earlier in the loop, and passing that to get it adjusted. Any adjustments that ntp_update_second makes to this time are then transferred to boot time. We can't pass it either the boot time or the uptime because their sum is what determines when a leap second is needed. This code adds an extra assignment and two extra compare in the typical case, which is as cheap as I could made it.
I have confirmed with this code the kernel time does the correct thing for both positive and negative leap seconds. Since the ntp interface doesn't allow for +2 or -2, those cases can't be tested (and the folks in the know here say there will never be a +2s or -2s leap event, but rather two +1s or -1s leap events).
There will very likely be no leap seconds for a while, given how the earth is speeding up and slowing down, so there will be plenty of time for this fix to propigate. UT1-UTC is currently at "about -0.4s" and decrementing by .1s every 8 months or so. 6 * 8 is 48 months, or 4 years.
-stable has different code, but a similar bug that was introduced about the time of the last leap second, which is why nobody has noticed until now.
MFC After: 3 weeks Reviewed by: phk
"Furthermore, leap seconds must die." -- Cato the Elder
|