4 * humandate - convert an NTP (or the current) time to something readable
8 #include "ntp_unixtime.h" /* includes <sys/time.h> and <time.h> */
9 #include "lib_strbuf.h"
10 #include "ntp_stdlib.h"
12 extern const char *months
[]; /* prettydate.c */
14 /* This is used in msyslog.c; we don't want to clutter up the log with
15 the year and day of the week, etc.; just the minimal date and time. */
21 time_t cursec
= time((time_t *) 0);
24 tm
= localtime(&cursec
);
26 return "-- --- --:--:--";
30 (void) sprintf(bp
, "%2d %s %02d:%02d:%02d",
31 tm
->tm_mday
, months
[tm
->tm_mon
],
32 tm
->tm_hour
, tm
->tm_min
, tm
->tm_sec
);