lkml.org 
[lkml]   [1996]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
Subjecttime problems in 1.3.77
(Since Sunday we have "Sommerzeit" (Daylight Saving Time) in Germany)
My CMOS clock runs local time (not UTC). As we had to advance the
local clocks in germany by one hour, I thought it's a nice idea to
correct my clock by using a DCF77 (German reference clock) receiver
and a little program (.../xntp/parse/util/dcfd.c) to do that. This
program sets the time using settimeofday().

As Linux knows about our timezone (MET or MET DST), the time was
rather correct when I started. After the program was running for some
time (> 30 minutes), the clock seemed to be ok, but after reboot I
had discovered that the clock was still one hour behind. Obviously
there's something wrong in kernel/time.c. I don't know what it is
exactly, but the CMOS clock isn't updated properly.

One problem seems to be that the warp_clock() depends on a _local_
flag in sys_settimeofday(). If you have a continuously running
system, you will have to "re-warp" the clock at beginning/end of DST.

BTW: There's also a bug in libc 5.2.18: __adjtimex() only fills the
old timex structure!

int
__ntp_gettime (struct ntptimeval * ntv)
{
struct timex tntx;
int result;
result = adjtimex(&tntx);
ntv->time = tntx.time;
ntv->maxerror = tntx.maxerror;
ntv->esterror = tntx.esterror;
return result;
}

In <sys/timex.h> there's the wrong structure declared:

struct ntptimeval {
struct timeval time; /* current time */
long maxerror; /* maximum error (usec) */
long esterror; /* estimated error (usec) */
};
Here's my little test program:

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#include <linux/timex.h>

#if 1
#include <syscall.h>
inline static
_syscall1(int, adjtimex, struct timex *, ntx);

static int __ntp_gettime(struct timex *ntv)
{
return(adjtimex(ntv));
}
#endif
get_values()
{
struct timex tx;
memset(&tx, 0, sizeof(tx));
tx.modes = 0;
if ( __ntp_gettime(&tx) != 0 )
return;
printf("%6ld %6ld %6ld %6ld %3d %6ld %6ld %6ld\n",
tx.offset, tx.freq, tx.maxerror, tx.esterror, tx.status,
tx.constant, tx.precision, tx.tolerance);
printf("%6ld %6ld %6ld %2ld %6ld %6ld %6ld\n",
tx.tick, tx.ppsfreq, tx.jitter, tx.shift, tx.stabil, tx.jitcnt,
tx.calcnt);
}
main()
{
printf("offset freq maxerr esterr sta consta precis tolera\n"
"tick ppsfre jitter sh stabil jitcnt calcnt\n"
"----------------------------------------------------\n");
for (;;)
{
get_values();
sleep(1);
}
}
Finally: On my Pentium 100 with enough RAM and SCSI (AHA2940) the
interrupt latency for ttyS0 is below 1ms (as experienced at user
level). Even with some CPU and disk load I have no problem. I'm
wondering if someone who does not have kerneld or EIDE drives has
problems with interrupt latency.

Ulrich


\
 
 \ /
  Last update: 2005-03-22 13:36    [from the cache]
©2003-2011 Jasper Spaans