diff options
author | Ollivier Robert <roberto@FreeBSD.org> | 2004-07-20 15:01:56 +0000 |
---|---|---|
committer | Ollivier Robert <roberto@FreeBSD.org> | 2004-07-20 15:01:56 +0000 |
commit | 9c2daa00c2315f101948c7144d62af5d5fb515cf (patch) | |
tree | 528d12dda44ebdc3ffcc38050f159ac553a69c17 /contrib/ntp/libntp/humandate.c | |
parent | ba371819a70ed076ebef04af93922a043272bfbe (diff) | |
download | src-9c2daa00c2315f101948c7144d62af5d5fb515cf.tar.gz src-9c2daa00c2315f101948c7144d62af5d5fb515cf.zip |
Virgin import of ntpd 4.2.0
Notes
Notes:
svn path=/vendor/ntp/dist/; revision=132451
Diffstat (limited to 'contrib/ntp/libntp/humandate.c')
-rw-r--r-- | contrib/ntp/libntp/humandate.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/contrib/ntp/libntp/humandate.c b/contrib/ntp/libntp/humandate.c index 7995633be4d3..52f5af1661a9 100644 --- a/contrib/ntp/libntp/humandate.c +++ b/contrib/ntp/libntp/humandate.c @@ -24,11 +24,14 @@ humandate( struct tm *tm; time_t sec; - LIB_GETBUF(bp); - sec = ntptime - JAN_1970; tm = localtime(&sec); + if (!tm) + return "--- --- -- ---- --:--:--"; + + LIB_GETBUF(bp); + (void) sprintf(bp, "%s, %s %2d %4d %2d:%02d:%02d", days[tm->tm_wday], months[tm->tm_mon], tm->tm_mday, 1900+tm->tm_year, tm->tm_hour, tm->tm_min, tm->tm_sec); @@ -47,6 +50,9 @@ humanlogtime(void) time_t cursec = time((time_t *) 0); struct tm *tm = localtime(&cursec); + if (!tm) + return "-- --- --:--:--"; + LIB_GETBUF(bp); (void) sprintf(bp, "%2d %s %02d:%02d:%02d", |