20 const int tolerate = 10;
29 syslog(LOG_DEBUG,
"check_date: %s: does not support DATE, "
30 "reply %d, expected 111", current_server->
name, reply);
36 if (lastline == NULL) {
38 "%s: warning: server disconnect or timeout in response to DATE command",
39 current_server->
name);
44 if (sscanf(lastline,
"%*d %4d%2d%2d%2d%2d%2d",
45 &tm.tm_year, &tm.tm_mon, &tm.tm_mday,
46 &tm.tm_hour, &tm.tm_min, &tm.tm_sec) < 6) {
49 "\"%s\"", current_server->
name, lastline);
58 if (t == (time_t) -1) {
61 "to DATE, mktime failed. \"%s\"", current_server->
name, lastline);
65 if (labs((
long)(t - time(&to))) > tolerate * 60
66#
if SIZEOF_TIME_T >= SIZEOF_LONG
67 || t - to > LONG_MAX || to - t > LONG_MAX
70 syslog(LOG_WARNING,
"check_date: %s: clocks of upstream and this computer are more than %d minutes apart. Check your system clock.", current_server->
name, tolerate);
71 printf(
"check_date: %s: clocks of upstream and this computer are more than\n%d minutes apart. Check your system clock.\n", current_server->
name, tolerate);
74 syslog(LOG_DEBUG,
"check_date: %s: server time %ld, our time %ld",
75 current_server->
name, (
long)t, (
long)to);
void check_date(const struct server *current_server)
time_t timegm(struct tm *tm)
int nntpreply(const struct server *)
void ln_log(int sev, int ctx, const char *format,...)