Spoon wrote:
> STEP 4: Check to see if the system time is correct
>
> # ntpdate -bv 145.238.110.68
> 26 Sep 13:39:04 ntpdate[878]: ntpdate [EMAIL PROTECTED] Fri Mar 16 10:45:44
> UTC 2007 (1)
> 26 Sep 13:39:04 ntpdate[878]: step time server 145.238.110.68 offset
> -0.497497 sec
>
> There's the ~500 ms error right there.
>
> IIUC this is a bug in the util-linux-2.12q hwclock?
Or it may have something to do with this:
Recognize Linux rtc device bug where read() returns immediately
instead of waiting for the update interrupt.
I believe I ran into the same problem when I was testing.
set_SCHED_RR(30);
int fd = open("/dev/rtc", O_RDONLY);
if (fd < 0) puts("OH NO!");
unsigned long dummy;
struct timespec t1;
clock_gettime(CLOCK_REALTIME, &t1); dump(&t1);
int err;
err = ioctl(fd, RTC_UIE_ON, 0);
if (err < 0) perror("RTC_UIE_ON");
clock_gettime(CLOCK_REALTIME, &t1); dump(&t1);
puts("ENTERING LOOP");
while ( 1 )
{
read(fd, &dummy, sizeof dummy);
clock_gettime(CLOCK_REALTIME, &t1);
printf("val=%lu ", dummy); dump(&t1);
}
# ./readrtc
1190816197.720601067
1190816197.720764109
ENTERING LOOP
val=256 1190816197.720781823
val=464 1190816198.482144222
val=464 1190816199.482134119
val=464 1190816200.482125214
After opening /dev/rtc T=x97.720601067
After setting RTC_UIE_ON T=x97.720764109
After the first read() T=x97.720781823
I.e. the first read() returns immediately with code 256.
The documentation for the RTC driver states:
The /dev/rtc interface will block on reads until an interrupt
has been received. If a RTC interrupt has already happened,
it will output an unsigned long and then block. The output value
contains the interrupt status in the low byte and the number of
interrupts since the last read in the remaining high bytes. The
/dev/rtc interface can also be used with the select(2) call.
code 256 means 1 interrupt and status = 0x00
code 464 means 1 interrupt and status = 0xD0
(What does these status mean?)
_______________________________________________
questions mailing list
[email protected]
https://lists.ntp.org/mailman/listinfo/questions