@ -1,4 +1,4 @@
/* $OpenBSD: ntp.c,v 1.93 2006/10/24 12:23:39 henning Exp $ */
/* $OpenBSD: ntp.c,v 1.94 2006/10/27 12:22:41 henning Exp $ */
/*
/*
* Copyright ( c ) 2003 , 2004 Henning Brauer < henning @ openbsd . org >
* Copyright ( c ) 2003 , 2004 Henning Brauer < henning @ openbsd . org >
@ -201,7 +201,7 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf)
bzero ( pfd , sizeof ( struct pollfd ) * pfd_elms ) ;
bzero ( pfd , sizeof ( struct pollfd ) * pfd_elms ) ;
bzero ( idx2peer , sizeof ( void * ) * idx2peer_elms ) ;
bzero ( idx2peer , sizeof ( void * ) * idx2peer_elms ) ;
nextaction = time ( NULL ) + 3600 ;
nextaction = getmono time( ) + 3600 ;
pfd [ PFD_PIPE_MAIN ] . fd = ibuf_main - > fd ;
pfd [ PFD_PIPE_MAIN ] . fd = ibuf_main - > fd ;
pfd [ PFD_PIPE_MAIN ] . events = POLLIN ;
pfd [ PFD_PIPE_MAIN ] . events = POLLIN ;
pfd [ PFD_HOTPLUG ] . fd = hotplugfd ;
pfd [ PFD_HOTPLUG ] . fd = hotplugfd ;
@ -217,7 +217,7 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf)
idx_peers = i ;
idx_peers = i ;
sent_cnt = trial_cnt = 0 ;
sent_cnt = trial_cnt = 0 ;
TAILQ_FOREACH ( p , & conf - > ntp_peers , entry ) {
TAILQ_FOREACH ( p , & conf - > ntp_peers , entry ) {
if ( p - > next > 0 & & p - > next < = time ( NULL ) ) {
if ( p - > next > 0 & & p - > next < = getmono time( ) ) {
if ( p - > state > STATE_DNS_INPROGRESS )
if ( p - > state > STATE_DNS_INPROGRESS )
trial_cnt + + ;
trial_cnt + + ;
if ( client_query ( p ) = = 0 )
if ( client_query ( p ) = = 0 )
@ -228,7 +228,7 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf)
if ( p - > deadline > 0 & & p - > deadline < nextaction )
if ( p - > deadline > 0 & & p - > deadline < nextaction )
nextaction = p - > deadline ;
nextaction = p - > deadline ;
if ( p - > deadline > 0 & & p - > deadline < = time ( NULL ) ) {
if ( p - > deadline > 0 & & p - > deadline < = getmono time( ) ) {
timeout = error_interval ( ) ;
timeout = error_interval ( ) ;
log_debug ( " no reply from %s received in time, "
log_debug ( " no reply from %s received in time, "
" next query %ds " , log_sockaddr (
" next query %ds " , log_sockaddr (
@ -251,9 +251,9 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf)
}
}
}
}
if ( last_sensor_scan + SENSOR_SCAN_INTERVAL < time ( NULL ) ) {
if ( last_sensor_scan + SENSOR_SCAN_INTERVAL < getmono time( ) ) {
sensor_scan ( ) ;
sensor_scan ( ) ;
last_sensor_scan = time ( NULL ) ;
last_sensor_scan = getmono time( ) ;
}
}
sensors_cnt = 0 ;
sensors_cnt = 0 ;
TAILQ_FOREACH ( s , & conf - > ntp_sensors , entry ) {
TAILQ_FOREACH ( s , & conf - > ntp_sensors , entry ) {
@ -270,7 +270,7 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf)
if ( ibuf_main - > w . queued > 0 )
if ( ibuf_main - > w . queued > 0 )
pfd [ PFD_PIPE_MAIN ] . events | = POLLOUT ;
pfd [ PFD_PIPE_MAIN ] . events | = POLLOUT ;
timeout = nextaction - time ( NULL ) ;
timeout = nextaction - getmono time( ) ;
if ( timeout < 0 )
if ( timeout < 0 )
timeout = 0 ;
timeout = 0 ;
@ -315,7 +315,7 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf)
for ( s = TAILQ_FIRST ( & conf - > ntp_sensors ) ; s ! = NULL ;
for ( s = TAILQ_FIRST ( & conf - > ntp_sensors ) ; s ! = NULL ;
s = next_s ) {
s = next_s ) {
next_s = TAILQ_NEXT ( s , entry ) ;
next_s = TAILQ_NEXT ( s , entry ) ;
if ( s - > next < = time ( NULL ) )
if ( s - > next < = getmono time( ) )
sensor_query ( s ) ;
sensor_query ( s ) ;
}
}
}
}