[Git][NTPsec/ntpsec][master] 2 commits: Use RFC3339 format in Mode 6 timestamps.
Eric S. Raymond
gitlab at mg.gitlab.com
Wed Mar 15 17:03:48 UTC 2017
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
f6a1d4c1 by Eric S. Raymond at 2017-03-15T12:44:52-04:00
Use RFC3339 format in Mode 6 timestamps.
- - - - -
c0c82141 by Eric S. Raymond at 2017-03-15T13:03:24-04:00
Boolification.
- - - - -
2 changed files:
- ntpd/ntp_control.c
- ntpd/ntp_leapsec.c
Changes:
=====================================
ntpd/ntp_control.c
=====================================
--- a/ntpd/ntp_control.c
+++ b/ntpd/ntp_control.c
@@ -69,7 +69,7 @@ static void ctl_putrefid (const char *, uint32_t);
static void ctl_putarray (const char *, double *, int);
static void ctl_putsys (int);
static void ctl_putpeer (int, struct peer *);
-static void ctl_putfs (const char *, time_t);
+static void ctl_puttime (const char *, time_t);
#ifdef REFCLOCK
static void ctl_putclock (int, struct refclockstat *, int);
#endif /* REFCLOCK */
@@ -1197,10 +1197,10 @@ ctl_putuint(
}
/*
- * ctl_putfs - write a decoded filestamp into the response
+ * ctl_puttime - write a decoded filestamp into the response
*/
static void
-ctl_putfs(
+ctl_puttime(
const char *tag,
time_t uval
)
@@ -1222,7 +1222,7 @@ ctl_putfs(
return;
NTP_INSIST((cp - buffer) < (int)sizeof(buffer));
snprintf(cp, sizeof(buffer) - (size_t)(cp - buffer),
- "%04d%02d%02d%02d%02d", tm->tm_year + 1900,
+ "%04d-%02d-%02dT%02d:%02dZ", tm->tm_year + 1900,
tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min);
cp += strlen(cp);
ctl_putdata(buffer, (unsigned)( cp - buffer ), false);
@@ -1622,7 +1622,7 @@ ctl_putsys(
leap_signature_t lsig;
leapsec_getsig(&lsig);
if (lsig.ttime > 0)
- ctl_putfs(sys_var[CS_LEAPTAB].text, lsig.ttime);
+ ctl_puttime(sys_var[CS_LEAPTAB].text, lsig.ttime);
break;
}
@@ -1631,7 +1631,7 @@ ctl_putsys(
leap_signature_t lsig;
leapsec_getsig(&lsig);
if (lsig.etime > 0)
- ctl_putfs(sys_var[CS_LEAPEND].text, lsig.etime);
+ ctl_puttime(sys_var[CS_LEAPEND].text, lsig.etime);
break;
}
=====================================
ntpd/ntp_leapsec.c
=====================================
--- a/ntpd/ntp_leapsec.c
+++ b/ntpd/ntp_leapsec.c
@@ -44,7 +44,7 @@ struct leap_info {
time_t ttime; /* transition time (after the step, POSIX epoch) */
time_t stime; /* schedule limit (a month before transition) */
int16_t taiof; /* TAI offset on and after the transition */
- uint8_t dynls; /* dynamic: inserted on peer/clock request */
+ bool dynls; /* dynamic: inserted on peer/clock request */
};
typedef struct leap_info leap_info_t;
@@ -59,7 +59,7 @@ struct leap_head {
time_t ttime; /* nominal transition time (next era start) */
time_t stime; /* schedule time (when we take notice) */
time_t ebase; /* base time of this leap era */
- uint8_t dynls; /* next leap is dynamic (by peer request) */
+ bool dynls; /* next leap is dynamic (by peer request) */
};
typedef struct leap_head leap_head_t;
@@ -253,7 +253,7 @@ leapsec_dump(
(*func)(farg, "%04u-%02u-%02u [%c] (%04u-%02u-%02u) - %d\n",
ttb.tm_year+1900, ttb.tm_mon+1, ttb.tm_mday,
- "-*"[pt->info[idx].dynls != 0],
+ "-*"[pt->info[idx].dynls],
atb.tm_year+1900, atb.tm_mon+1, atb.tm_mday,
pt->info[idx].taiof);
}
@@ -745,7 +745,7 @@ reload_limits(
pt->head.stime = pt->head.ttime;
pt->head.dtime = pt->head.ttime;
pt->head.next_tai = pt->head.this_tai;
- pt->head.dynls = 0;
+ pt->head.dynls = false;
}
}
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/0a56f7f612da3a4c9ec80704a9aa72eee1af3b80...c0c821419297bc789323f6ec699d7b202e0109d2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170315/e05ea03c/attachment.html>
More information about the vc
mailing list