1 /* adjtime -- adjust the system clock. Linux/Alpha/tv32 version.
2 Copyright (C) 2019-2020 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 #include <shlib-compat.h>
21 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
24 #include <sys/timex.h>
25 #include <tv32-compat.h>
28 unsigned int modes
; /* mode selector */
29 long offset
; /* time offset (usec) */
30 long freq
; /* frequency offset (scaled ppm) */
31 long maxerror
; /* maximum error (usec) */
32 long esterror
; /* estimated error (usec) */
33 int status
; /* clock command/status */
34 long constant
; /* pll time constant */
35 long precision
; /* clock precision (usec) (read only) */
36 long tolerance
; /* clock frequency tolerance (ppm)
39 struct timeval32 time
; /* (read only) */
40 long tick
; /* (modified) usecs between clock ticks */
42 long ppsfreq
; /* pps frequency (scaled ppm) (ro) */
43 long jitter
; /* pps jitter (us) (ro) */
44 int shift
; /* interval duration (s) (shift) (ro) */
45 long stabil
; /* pps stability (scaled ppm) (ro) */
46 long jitcnt
; /* jitter limit exceeded (ro) */
47 long calcnt
; /* calibration intervals (ro) */
48 long errcnt
; /* calibration errors (ro) */
49 long stbcnt
; /* stability limit exceeded (ro) */
51 int :32; int :32; int :32; int :32;
52 int :32; int :32; int :32; int :32;
53 int :32; int :32; int :32; int :32;
57 attribute_compat_text_section
58 __adjtime_tv32 (const struct timeval32
*itv
, struct timeval32
*otv
)
60 struct timeval itv64
= valid_timeval_to_timeval64 (*itv
);
63 if (__adjtime (&itv64
, &otv64
) == -1)
66 *otv
= valid_timeval64_to_timeval (otv64
);
71 attribute_compat_text_section
72 __adjtimex_tv32 (struct timex32
*tx
)
75 memset (&tx64
, 0, sizeof tx64
);
76 tx64
.modes
= tx
->modes
;
77 tx64
.offset
= tx
->offset
;
79 tx64
.maxerror
= tx
->maxerror
;
80 tx64
.esterror
= tx
->esterror
;
81 tx64
.status
= tx
->status
;
82 tx64
.constant
= tx
->constant
;
83 tx64
.precision
= tx
->precision
;
84 tx64
.tolerance
= tx
->tolerance
;
86 tx64
.ppsfreq
= tx
->ppsfreq
;
87 tx64
.jitter
= tx
->jitter
;
88 tx64
.shift
= tx
->shift
;
89 tx64
.stabil
= tx
->stabil
;
90 tx64
.jitcnt
= tx
->jitcnt
;
91 tx64
.calcnt
= tx
->calcnt
;
92 tx64
.errcnt
= tx
->errcnt
;
93 tx64
.stbcnt
= tx
->stbcnt
;
94 tx64
.time
= valid_timeval_to_timeval64 (tx
->time
);
96 int status
= __adjtimex (&tx64
);
100 memset (tx
, 0, sizeof *tx
);
101 tx
->modes
= tx64
.modes
;
102 tx
->offset
= tx64
.offset
;
103 tx
->freq
= tx64
.freq
;
104 tx
->maxerror
= tx64
.maxerror
;
105 tx
->esterror
= tx64
.esterror
;
106 tx
->status
= tx64
.status
;
107 tx
->constant
= tx64
.constant
;
108 tx
->precision
= tx64
.precision
;
109 tx
->tolerance
= tx64
.tolerance
;
110 tx
->tick
= tx64
.tick
;
111 tx
->ppsfreq
= tx64
.ppsfreq
;
112 tx
->jitter
= tx64
.jitter
;
113 tx
->shift
= tx64
.shift
;
114 tx
->stabil
= tx64
.stabil
;
115 tx
->jitcnt
= tx64
.jitcnt
;
116 tx
->calcnt
= tx64
.calcnt
;
117 tx
->errcnt
= tx64
.errcnt
;
118 tx
->stbcnt
= tx64
.stbcnt
;
119 tx
->time
= valid_timeval64_to_timeval (tx64
.time
);
124 strong_alias (__adjtimex_tv32
, __adjtimex_tv32_1
);
125 strong_alias (__adjtimex_tv32
, __adjtimex_tv32_2
);
126 compat_symbol (libc
, __adjtimex_tv32_1
, __adjtimex
, GLIBC_2_0
);
127 compat_symbol (libc
, __adjtimex_tv32_2
, adjtimex
, GLIBC_2_0
);
128 compat_symbol (libc
, __adjtime_tv32
, adjtime
, GLIBC_2_0
);
130 #endif /* SHLIB_COMPAT */