[Git][NTPsec/ntpsec][master] 2 commits: fstostr -> rfc3339time
Eric S. Raymond
gitlab at mg.gitlab.com
Wed Mar 15 16:20:15 UTC 2017
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
52e946a8 by Eric S. Raymond at 2017-03-15T12:08:58-04:00
fstostr -> rfc3339time
- - - - -
34573609 by Eric S. Raymond at 2017-03-15T12:19:55-04:00
Do real RFC3339 time.
- - - - -
2 changed files:
- include/ntpd.h
- ntpd/ntp_util.c
Changes:
=====================================
include/ntpd.h
=====================================
--- a/include/ntpd.h
+++ b/include/ntpd.h
@@ -234,7 +234,7 @@ extern void record_crypto_stats (sockaddr_u *, const char *);
#ifdef DEBUG
extern void record_timing_stats (const char *);
#endif
-extern char * fstostr(time_t);
+extern char * rfc3339time(time_t);
/* packetstamp.c */
extern void enable_packetstamps(int, sockaddr_u *);
=====================================
ntpd/ntp_util.c
=====================================
--- a/ntpd/ntp_util.c
+++ b/ntpd/ntp_util.c
@@ -326,11 +326,11 @@ stats_config(
mprintf_event(EVNT_TAI, NULL,
"%d leap %s %s %s",
lsig.taiof,
- fstostr(lsig.ttime),
+ rfc3339time(lsig.ttime),
leapsec_expired(ttnow)
? "expired"
: "expires",
- fstostr(lsig.etime));
+ rfc3339time(lsig.etime));
have_leapfile = true;
/* force an immediate daily expiration check of
@@ -820,9 +820,9 @@ ntp_exit(int retval)
#endif
/*
- * fstostr - prettyprint time stamp - POSIX epoch
+ * rfc3339time - prettyprint time stamp - POSIX epoch
*/
-char * fstostr(
+char * rfc3339time(
time_t posix_stamp
)
{
@@ -832,13 +832,13 @@ char * fstostr(
LIB_GETBUF(buf);
tm2 = gmtime_r(&posix_stamp, &tm);
if (tm2 == NULL || tm.tm_year > 9999)
- snprintf(buf, LIB_BUFLENGTH, "fstostr: %ld: range error",
+ snprintf(buf, LIB_BUFLENGTH, "rfc3339time: %ld: range error",
(long)posix_stamp);
// if (ntpcal_ntp_to_date(&tm, (uint32_t)ntp_stamp, NULL) < 0)
// snprintf(buf, LIB_BUFLENGTH, "ntpcal_ntp_to_date: %ld: range error",
// (long)ntp_stamp);
else
- snprintf(buf, LIB_BUFLENGTH, "%04d%02d%02d%02d%02d",
+ snprintf(buf, LIB_BUFLENGTH, "%04d-%02d-%02dT%02d:%02dZ",
tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday,
tm.tm_hour, tm.tm_min);
return buf;
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/c4d69c198cb347f4dad0785558eb0c8a137d2074...345736090af49c953e7c473a58d00f674a8d5023
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170315/774cfe62/attachment.html>
More information about the vc
mailing list