~ubuntu-branches/debian/sid/ntp/sid

« back to all changes in this revision

Viewing changes to ports/winnt/ntpd/nt_clockstuff.c

  • Committer: Package Import Robot
  • Author(s): Peter Eisentraut
  • Date: 2012-02-27 13:55:56 UTC
  • mfrom: (1.2.12)
  • Revision ID: package-import@ubuntu.com-20120227135556-dkx4mkod5trl5bgt
Tags: 1:4.2.6.p5+dfsg-1
* New upstream release (closes: #644673)
* Updated instructions on generating autotools.patch
* Updated standards version

Show diffs side-by-side

added added

removed removed

Lines of Context:
188
188
static DOUBLE ppm_per_adjust_unit = 0.0;
189
189
 
190
190
/*
 
191
 * wintickadj emulates the functionality provided by unix tickadj,
 
192
 * providing a baseline clock correction if needed to get the
 
193
 * clock within a few hundred PPM of correct frequency.
 
194
 */
 
195
static long wintickadj;
 
196
 
 
197
/*
191
198
 * performance counter frequency observations
192
199
 */
193
200
#define TUNE_CTR_DEPTH          3       /* running avg depth */
557
564
 
558
565
 
559
566
        /* only adjust the clock if adjustment changes */
 
567
        TimeAdjustment += wintickadj;
560
568
        if (last_Adj != TimeAdjustment) {
561
569
                last_Adj = TimeAdjustment;
562
570
                DPRINTF(1, ("SetSystemTimeAdjustment(%+ld)\n", TimeAdjustment));
592
600
        LARGE_INTEGER Freq;
593
601
        FT_ULL initial_hectonanosecs;
594
602
        FT_ULL next_hectonanosecs;
 
603
        double adjppm;
 
604
        double rawadj;
 
605
        char * pch;
595
606
 
596
607
        if (winnt_time_initialized)
597
608
                return;
775
786
                (LONGLONG)os_clock_precision / 1e4, 
776
787
                ppm_per_adjust_unit);
777
788
 
 
789
        pch = getenv("NTPD_TICKADJ_PPM");
 
790
        if (pch != NULL && 1 == sscanf(pch, "%lf", &adjppm)) {
 
791
                rawadj = adjppm / ppm_per_adjust_unit;
 
792
                rawadj += (rawadj < 0)
 
793
                              ? -0.5
 
794
                              : 0.5;
 
795
                wintickadj = (long)rawadj;
 
796
                msyslog(LOG_INFO,
 
797
                        "Using NTPD_TICKADJ_PPM %+g ppm (%+ld)",
 
798
                        adjppm, wintickadj);
 
799
        }
 
800
 
778
801
        winnt_time_initialized = TRUE;
779
802
 
780
803
        choose_interp_counter();