: This is relative to PPSkit-0.6.0, and unless proven incorrect, it will : be in the next release of PPSkit-0.6. : Feedback welcome! Index: arch/i386/kernel/time.c =================================================================== RCS file: /root/21REP/linux21/arch/i386/kernel/time.c,v retrieving revision 1.1.1.6.4.1 diff -u -r1.1.1.6.4.1 time.c --- arch/i386/kernel/time.c 1999/04/07 10:43:05 1.1.1.6.4.1 +++ arch/i386/kernel/time.c 1999/04/21 19:22:03 @@ -28,7 +28,7 @@ * 1998-12-24 Copyright (C) 1998 Andrea Arcangeli * Fixed a xtime SMP race (we need the xtime_lock rw spinlock to * serialize accesses to xtime/lost_ticks). - * 1999-03-10 Ulrich Windl + * 1999-04-21 Ulrich Windl * Modifications for nanosecond resolution. Several cleanups, including * renaming. Fixed bug for ``CONFIG_X86_TSC'' with bad CPU * implementation. ``calibrate_tsc()'' calibrates for nanoseconds now. @@ -65,11 +65,10 @@ */ #include "irq.h" +unsigned long cpu_hz; /* Set if TSC is configured and operational */ #ifdef CONFIG_X86_TSC static int use_tsc = 0; - -unsigned long cpu_hz; /* Detected as we calibrate the TSC */ /* Number of microseconds that the last interrupt was delayed */ static long microdelay_at_last_interrupt; Index: arch/sparc/kernel/pcic.c =================================================================== RCS file: /root/21REP/linux21/arch/sparc/kernel/pcic.c,v retrieving revision 1.1.1.2.4.1 diff -u -r1.1.1.2.4.1 pcic.c --- arch/sparc/kernel/pcic.c 1999/04/07 10:43:52 1.1.1.2.4.1 +++ arch/sparc/kernel/pcic.c 1999/04/21 19:31:15 @@ -489,20 +489,10 @@ } } +/* is this needed at all? */ static void pci_do_settimeofday(struct timeval *tv) { - cli(); - tv->tv_usec -= do_gettimeoffset(); - if(tv->tv_usec < 0) { - tv->tv_usec += 1000000; - tv->tv_sec--; - } - xtime = *tv; - time_adjust = 0; /* stop active adjtime() */ - time_status |= STA_UNSYNC; - time_maxerror = NTP_PHASE_LIMIT; - time_esterror = NTP_PHASE_LIMIT; - sti(); + do_settimeofday(tv); } #if 0 Index: include/linux/time.h =================================================================== RCS file: /root/21REP/linux21/include/linux/time.h,v retrieving revision 1.1.1.1.10.1 diff -u -r1.1.1.1.10.1 time.h --- include/linux/time.h 1999/04/07 10:45:19 1.1.1.1.10.1 +++ include/linux/time.h 1999/04/21 19:40:16 @@ -82,7 +82,6 @@ /* kernel time variables */ extern long time_tick; /* time increment */ -extern long time_adjust; /* remaining time adjustment */ /* Gregorian date & time as UNIX time */ extern unsigned long mktime(unsigned int year, unsigned int mon, Index: kernel/time.c =================================================================== RCS file: /root/21REP/linux21/kernel/time.c,v retrieving revision 1.1.1.3.4.2 diff -u -r1.1.1.3.4.2 time.c --- kernel/time.c 1999/04/07 19:11:32 1.1.1.3.4.2 +++ kernel/time.c 1999/04/21 19:42:49 @@ -56,11 +56,11 @@ * Split NTP PPS support into different levels: NTP, NTP with PPS, * NTP with PPS and serial carrier detect. Moved time stuff from * sched.c to the place where it really belongs. - * 1999-04-07 Ulrich Windl + * 1999-04-21 Ulrich Windl * Merged in changes for new NTP clock model (`nanokernel'). Added new * do_clock_{get,set}time (see POSIX.4). Added do_clock_getres * (see POSIX.4). Made heavy changes to the clock model and related - * variables. Added mktime(). + * variables. Added mktime(). Fixes for the `nanokernel'. */ #define NANO /* we want to see nanoseconds in */ #include @@ -88,7 +88,7 @@ struct timezone sys_tz = { 0, 0}; /* kernel time variables */ -long time_adjust = 0; /* remaining time adjustment */ +static long time_adjust = 0; /* remaining adjustment for adjtime() */ static int tickadj; /* number of microsecs to adjust time_tick */ static int hz; /* timer interrupt frequency */ @@ -750,9 +750,8 @@ * outside the range gate, keep the later hit but do not * process it. */ - time_status |= STA_PPSSIGNAL | STA_PPSJITTER; + time_status |= STA_PPSJITTER; time_status &= ~(STA_PPSWANDER | STA_PPSERROR); - pps.valid = PPS_VALID; u_sec = p_ts->tv_sec; u_nsec = p_ts->tv_nsec; /* relative position around second */ if (u_nsec >= (NANOSECOND >> 1)) { @@ -804,8 +803,14 @@ pps.tf[1].sec % 10, pps.tf[1].nsec, pps.tf[0].sec % 10, pps.tf[0].nsec, u_nsec); #endif + /* duplicated PPS pulses would significantly add to the FLL; + * assume some problem and better restart FLL calibration. + */ + pps.shift = PPS_FAVG; /* not in reference implementation */ goto done; } + pps.valid = PPS_VALID; + time_status |= STA_PPSSIGNAL; time_status &= ~STA_PPSJITTER; /* @@ -856,6 +861,7 @@ } else if (time_status & STA_PPSTIME) { pps.offacc -= pps.filt.nsec; if (++pps.offcnt >= (1 << PPS_PAVG)) { + time_adjust = 0; /* cancel running adjtime() */ /* update time_offset */ L_LINT(time_offset, pps.offacc); L_RSHIFT(time_offset, PPS_PAVG); @@ -1026,7 +1032,10 @@ ltemp = -MAXPHASE; if (!(time_status & STA_PPSTIME && time_status & STA_PPSSIGNAL)) L_LINT(time_offset, ltemp); - + /* As we do precision adjustments now, let's cancel any + * remaining correction from a previous adjtime() call. + */ + time_adjust = 0; /* * Select how the frequency is to be controlled and in which @@ -1101,6 +1110,30 @@ } } #undef OLD_ADJTIME +#if 1 /* Establish extra warnings for older applications */ +#define OLD_ADJTICK (STA_MODE) + if ((txc->modes & OLD_ADJTICK) == OLD_ADJTICK) { + static int complain = 5; + if (complain) { + --complain; + printk(KERN_WARNING + "adjtimex: %s may be using obsolete ADJ_TICK\n", + current->comm); + } + } +#undef OLD_ADJTICK +#define OLD_ADJTICKADJ (STA_NANO) + if ((txc->modes & OLD_ADJTICKADJ) == OLD_ADJTICKADJ) { + static int complain = 5; + if (complain) { + --complain; + printk(KERN_WARNING + "adjtimex: %s may be using obsolete ADJ_TICKADJ\n", + current->comm); + } + } +#undef OLD_ADJTICKADJ +#endif #endif if (txc->modes & MOD_OFFSET) { if ((time_status & STA_NANO) == 0)