003 File Manager
Current Path:
/usr/src/contrib/ntp/ntpd
usr
/
src
/
contrib
/
ntp
/
ntpd
/
📁
..
📄
Makefile.am
(13.57 KB)
📄
Makefile.in
(78.52 KB)
📄
check_y2k.c
(15.73 KB)
📄
cmd_args.c
(4.25 KB)
📄
complete.conf.in
(3.35 KB)
📄
declcond.h
(793 B)
📄
invoke-ntp.conf.menu
(56 B)
📄
invoke-ntp.conf.texi
(104.37 KB)
📄
invoke-ntp.keys.menu
(56 B)
📄
invoke-ntp.keys.texi
(3.21 KB)
📄
invoke-ntpd.menu
(49 B)
📄
invoke-ntpd.texi
(23.68 KB)
📄
jupiter.h
(9.1 KB)
📄
keyword-gen-utd
(57 B)
📄
keyword-gen.c
(21.99 KB)
📄
ntp.conf.5man
(115.01 KB)
📄
ntp.conf.5mdoc
(101.72 KB)
📄
ntp.conf.def
(100.75 KB)
📄
ntp.conf.html
(126.28 KB)
📄
ntp.conf.man.in
(115.01 KB)
📄
ntp.conf.mdoc.in
(101.71 KB)
📄
ntp.conf.texi
(1.19 KB)
📄
ntp.keys.5man
(3.99 KB)
📄
ntp.keys.5mdoc
(4.25 KB)
📄
ntp.keys.def
(3.65 KB)
📄
ntp.keys.html
(8.37 KB)
📄
ntp.keys.man.in
(3.99 KB)
📄
ntp.keys.mdoc.in
(4.24 KB)
📄
ntp.keys.texi
(1.2 KB)
📄
ntp_config.c
(117.55 KB)
📄
ntp_control.c
(123.14 KB)
📄
ntp_crypto.c
(117.09 KB)
📄
ntp_filegen.c
(13.42 KB)
📄
ntp_io.c
(112.21 KB)
📄
ntp_keyword.h
(73.49 KB)
📄
ntp_leapsec.c
(31.18 KB)
📄
ntp_leapsec.h
(10.95 KB)
📄
ntp_loopfilter.c
(40.05 KB)
📄
ntp_monitor.c
(13.43 KB)
📄
ntp_parser.c
(130.65 KB)
📄
ntp_parser.h
(11.36 KB)
📄
ntp_peer.c
(27.66 KB)
📄
ntp_prio_q.c
(4.54 KB)
📄
ntp_proto.c
(150.76 KB)
📄
ntp_refclock.c
(43.87 KB)
📄
ntp_request.c
(67.25 KB)
📄
ntp_restrict.c
(19.06 KB)
📄
ntp_scanner.c
(20.74 KB)
📄
ntp_scanner.h
(4.43 KB)
📄
ntp_signd.c
(5.24 KB)
📄
ntp_timer.c
(17.69 KB)
📄
ntp_util.c
(22.66 KB)
📄
ntpd-opts.c
(71.91 KB)
📄
ntpd-opts.def
(17.55 KB)
📄
ntpd-opts.h
(14.57 KB)
📄
ntpd.1ntpdman
(32.03 KB)
📄
ntpd.1ntpdmdoc
(29.07 KB)
📄
ntpd.c
(42.16 KB)
📄
ntpd.html
(49.68 KB)
📄
ntpd.man.in
(32.03 KB)
📄
ntpd.mdoc.in
(29.07 KB)
📄
ntpd.texi
(3.25 KB)
📄
ntpdbase-opts.def
(13.21 KB)
📄
ntpsim.c
(17.11 KB)
📄
ppsapi_timepps.h
(497 B)
📄
psl0.conf
(25 B)
📄
psl1.conf
(25 B)
📄
psl2.conf
(37 B)
📄
rc_cmdlength.c
(800 B)
📄
refclock_acts.c
(22.66 KB)
📄
refclock_arbiter.c
(12.15 KB)
📄
refclock_arc.c
(46.85 KB)
📄
refclock_as2201.c
(11.09 KB)
📄
refclock_atom.c
(6.63 KB)
📄
refclock_bancomm.c
(16.11 KB)
📄
refclock_chronolog.c
(7.61 KB)
📄
refclock_chu.c
(45.28 KB)
📄
refclock_conf.c
(7.25 KB)
📄
refclock_datum.c
(22.3 KB)
📄
refclock_dumbclock.c
(8.42 KB)
📄
refclock_fg.c
(6.89 KB)
📄
refclock_gpsdjson.c
(58 KB)
📄
refclock_gpsvme.c
(7.77 KB)
📄
refclock_heath.c
(12.97 KB)
📄
refclock_hopfpci.c
(5.69 KB)
📄
refclock_hopfser.c
(7.41 KB)
📄
refclock_hpgps.c
(16.38 KB)
📄
refclock_irig.c
(30.05 KB)
📄
refclock_jjy.c
(144.27 KB)
📄
refclock_jupiter.c
(25.66 KB)
📄
refclock_leitch.c
(13.27 KB)
📄
refclock_local.c
(5.72 KB)
📄
refclock_msfees.c
(44.66 KB)
📄
refclock_mx4200.c
(41.72 KB)
📄
refclock_neoclock4x.c
(29.08 KB)
📄
refclock_nmea.c
(50.6 KB)
📄
refclock_oncore.c
(121.54 KB)
📄
refclock_palisade.c
(35.15 KB)
📄
refclock_palisade.h
(6.52 KB)
📄
refclock_parse.c
(160.87 KB)
📄
refclock_pcf.c
(4.79 KB)
📄
refclock_pst.c
(8.09 KB)
📄
refclock_ripencc.c
(118.21 KB)
📄
refclock_shm.c
(16.96 KB)
📄
refclock_tpro.c
(4.69 KB)
📄
refclock_true.c
(25.3 KB)
📄
refclock_tsyncpci.c
(28.35 KB)
📄
refclock_tt560.c
(6.12 KB)
📄
refclock_ulink.c
(15.64 KB)
📄
refclock_wwv.c
(79.32 KB)
📄
refclock_wwvb.c
(15.71 KB)
📄
refclock_zyfer.c
(7.38 KB)
Editing: ntp_leapsec.h
/* * ntp_leapsec.h - leap second processing for NTPD * * Written by Juergen Perlinger (perlinger@ntp.org) for the NTP project. * The contents of 'html/copyright.html' apply. * ---------------------------------------------------------------------- * This is an attempt to get the leap second handling into a dedicated * module to make the somewhat convoluted logic testable. */ #ifndef NTP_LEAPSEC_H #define NTP_LEAPSEC_H struct stat; /* function pointer types. Note that 'fprintf' and 'getc' can be casted * to the dumper resp. reader type, provided the auxiliary argument is a * valid FILE pointer in hat case. */ typedef void (*leapsec_dumper)(void*, const char *fmt, ...); typedef int (*leapsec_reader)(void*); struct leap_table; typedef struct leap_table leap_table_t; /* Validate a stream containing a leap second file in the NIST / NTPD * format that can also be loaded via 'leapsec_load()'. This uses * the SHA1 hash and preprocessing as described in the NIST leapsecond * file. */ #define LSVALID_GOODHASH 1 /* valid signature */ #define LSVALID_NOHASH 0 /* no signature in file */ #define LSVALID_BADHASH -1 /* signature mismatch */ #define LSVALID_BADFORMAT -2 /* signature not parseable */ extern int leapsec_validate(leapsec_reader, void*); /* Set/get electric mode * Electric mode is defined as the operation mode where the system clock * automagically manages the leap second, so we don't have to care about * stepping the clock. (This should be the case with most systems, * including the current implementation of the Win32 timekeeping.) * * The consequence of electric mode is that we do not 'see' the leap * second, and no client actions are needed when crossing the leap era * boundary. In manual (aka non-electric) mode the clock will simply * step forward untill *we* (that is, this module) tells the client app * to step at the right time. This needs a slightly different type of * processing, so switching between those two modes should not be done * too close to a leap second. The transition might be lost in that * case. (The limit is actual 2 sec before transition.) * * OTOH, this is a system characteristic, so it's expected to be set * properly somewhere after system start and retain the value. * * Simply querying the state or setting it to the same value as before * does not have any unwanted side effects. You can query by giving a * negative value for the switch. */ extern int/*BOOL*/ leapsec_electric(int/*BOOL*/ on); /* Query result for a leap era. This is the minimal stateless * information available for a time stamp in UTC. */ struct leap_era { vint64 ebase; /* era base (UTC of start) */ vint64 ttime; /* era end (UTC of next leap second) */ int16_t taiof; /* offset to TAI in this era */ }; typedef struct leap_era leap_era_t; /* Query result for a leap second schedule * 'ebase' is the nominal UTC time when the current leap era * started. (Era base time) * 'ttime' is the next transition point in full time scale. (Nominal UTC * time when the next leap era starts.) * 'ddist' is the distance to the transition, in clock seconds. * This is the distance to the due time, which is different * from the transition time if the mode is non-electric. * Only valid if 'tai_diff' is not zero. * 'tai_offs' is the CURRENT distance from clock (UTC) to TAI. Always * valid. * 'tai_diff' is the change in TAI offset after the next leap * transition. Zero if nothing is pending or too far ahead. * 'warped' is set only once, when the the leap second occurred between * two queries. Always zero in electric mode. If non-zero, * immediately step the clock. * 'proximity' is a proximity warning. See definitions below. This is * more useful than an absolute difference to the leap second. * 'dynamic' != 0 if entry was requested by clock/peer */ struct leap_result { vint64 ebase; vint64 ttime; uint32_t ddist; int16_t tai_offs; int16_t tai_diff; int16_t warped; uint8_t proximity; uint8_t dynamic; }; typedef struct leap_result leap_result_t; /* The leap signature is used in two distinct circumstances, and it has * slightly different content in these cases: * - it is used to indictae the time range covered by the leap second * table, and then it contains the last transition, TAI offset after * the final transition, and the expiration time. * - it is used to query data for AUTOKEY updates, and then it contains * the *current* TAI offset, the *next* transition time and the * expiration time of the table. */ struct leap_signature { uint32_t etime; /* expiration time */ uint32_t ttime; /* transition time */ int16_t taiof; /* total offset to TAI */ }; typedef struct leap_signature leap_signature_t; #ifdef LEAP_SMEAR struct leap_smear_info { int enabled; /* not 0 if smearing is generally enabled */ int in_progress; /* not 0 if smearing is in progress, i.e. the offset has been computed */ int leap_occurred; /* not 0 if the leap second has already occurred, i.e., during the leap second */ double doffset; /* the current smear offset as double */ l_fp offset; /* the current smear offset */ uint32_t t_offset; /* the current time for which a smear offset has been computed */ long interval; /* smear interval, in [s], should be at least some hours */ double intv_start; /* start time of the smear interval */ double intv_end; /* end time of the smear interval */ }; typedef struct leap_smear_info leap_smear_info_t; #endif /* LEAP_SMEAR */ #define LSPROX_NOWARN 0 /* clear radar screen */ #define LSPROX_SCHEDULE 1 /* less than 1 month to target*/ #define LSPROX_ANNOUNCE 2 /* less than 1 day to target */ #define LSPROX_ALERT 3 /* less than 10 sec to target */ /* Get the current or alternate table pointer. Getting the alternate * pointer will automatically copy the primary table, so it can be * subsequently modified. */ extern leap_table_t *leapsec_get_table(int alternate); /* Set the current leap table. Accepts only return values from * 'leapsec_get_table()', so it's hard to do something wrong. Returns * TRUE if the current table is the requested one. */ extern int/*BOOL*/ leapsec_set_table(leap_table_t *); /* Clear all leap second data. Use it for init & cleanup */ extern void leapsec_clear(leap_table_t*); /* Load a leap second file. If 'blimit' is set, do not store (but * register with their TAI offset) leap entries before the build date. * Update the leap signature data on the fly. */ extern int/*BOOL*/ leapsec_load(leap_table_t*, leapsec_reader, void*, int blimit); /* Dump the current leap table in readable format, using the provided * dump formatter function. */ extern void leapsec_dump(const leap_table_t*, leapsec_dumper func, void *farg); /* Read a leap second file from stream. This is a convenience wrapper * around the generic load function, 'leapsec_load()'. */ extern int/*BOOL*/ leapsec_load_stream(FILE * fp, const char * fname, int/*BOOL*/logall, int/*BOOL*/vhash); /* Read a leap second file from file. It checks that the file exists and * (if 'force' is not applied) the ctime/mtime has changed since the * last load. If the file has to be loaded, either due to 'force' or * changed time stamps, the 'stat()' results of the file are stored in * '*sb' for the next cycle. Returns TRUE on successful load, FALSE * otherwise. Uses 'leapsec_load_stream()' internally. */ extern int/*BOOL*/ leapsec_load_file(const char * fname, struct stat * sb, int/*BOOL*/force, int/*BOOL*/logall, int/*BOOL*/vhash); /* Get the current leap data signature. This consists of the last * ransition, the table expiration, and the total TAI difference at the * last transition. This is valid even if the leap transition itself was * culled due to the build date limit. */ extern void leapsec_getsig(leap_signature_t * psig); /* Check if the leap table is expired at the given time. */ extern int/*BOOL*/ leapsec_expired(uint32_t when, const time_t * pivot); /* Get the distance to expiration in days. * Returns negative values if expired, zero if there are less than 24hrs * left, and positive numbers otherwise. */ extern int32_t leapsec_daystolive(uint32_t when, const time_t * pivot); /* Reset the current leap frame, so the next query will do proper table * lookup from fresh. Suppresses a possible leap era transition detection * for the next query. */ extern void leapsec_reset_frame(void); #if 0 /* currently unused -- possibly revived later */ /* Given a transition time, the TAI offset valid after that and an * expiration time, try to establish a system leap transition. Only * works if the existing table is extended. On success, updates the * signature data. */ extern int/*BOOL*/ leapsec_add_fix(int offset, uint32_t ttime, uint32_t etime, const time_t * pivot); #endif /* Take a time stamp and create a leap second frame for it. This will * schedule a leap second for the beginning of the next month, midnight * UTC. The 'insert' argument tells if a leap second is added (!=0) or * removed (==0). We do not handle multiple inserts (yet?) * * Returns 1 if the insert worked, 0 otherwise. (It's not possible to * insert a leap second into the current history -- only appending * towards the future is allowed!) * * 'ntp_now' is subject to era unfolding. The entry is marked * dynamic. The leap signature is NOT updated. */ extern int/*BOOL*/ leapsec_add_dyn(int/*BOOL*/ insert, uint32_t ntp_now, const time_t * pivot); /* Take a time stamp and get the associated leap information. The time * stamp is subject to era unfolding around the pivot or the current * system time if pivot is NULL. Sets the information in '*qr' and * returns TRUE if a leap second era boundary was crossed between the * last and the current query. In that case, qr->warped contains the * required clock stepping, which is always zero in electric mode. */ extern int/*BOOL*/ leapsec_query(leap_result_t * qr, uint32_t ntpts, const time_t * pivot); /* For a given time stamp, fetch the data for the bracketing leap * era. The time stamp is subject to NTP era unfolding. */ extern int/*BOOL*/ leapsec_query_era(leap_era_t * qr, uint32_t ntpts, const time_t * pivot); /* Get the current leap frame info. Returns TRUE if the result contains * useable data, FALSE if there is currently no leap second frame. * This merely replicates some results from a previous query, but since * it does not check the current time, only the following entries are * meaningful: * qr->ttime; * qr->tai_offs; * qr->tai_diff; * qr->dynamic; */ extern int/*BOOL*/ leapsec_frame(leap_result_t *qr); /* Process a AUTOKEY TAI offset information. This *might* augment the * current leap data table with the given TAI offset. * Returns TRUE if action was taken, FALSE otherwise. */ extern int/*BOOL*/ leapsec_autokey_tai(int tai_offset, uint32_t ntpnow, const time_t * pivot); /* reset global state for unit tests */ extern void leapsec_ut_pristine(void); #endif /* !defined(NTP_LEAPSEC_H) */
Upload File
Create Folder