*** sntp.c Thu Oct 16 17:43:24 2003 --- my_sntp.c Wed Feb 18 20:08:40 2004 *************** *** 140,145 **** --- 140,146 ---- static struct sockaddr *sntp_servers = NULL; static cyg_uint32 sntp_num_servers = 0; static cyg_mutex_t sntp_mutex; + static time_t NextTimeUpdate = 0; /* SNTP Timeouts * *************** *** 216,222 **** #ifdef CYGPKG_NET_SNTP_UNICAST int i; struct timeval timeout; - time_t NextTimeUpdate = 0; #endif /* CYGPKG_NET_SNTP_UNICAST */ struct timeval *ptimeout = NULL; --- 217,222 ---- *************** *** 329,335 **** * up when it's time to send more * requests. */ ! timeout.tv_sec = NextTimeUpdate - current_time; } else { /* It's already time for us to update our time */ NextTimeUpdate = 0; --- 329,336 ---- * up when it's time to send more * requests. */ ! timeout.tv_sec = (SNTP_WAITPERIOD > (NextTimeUpdate - current_time)? ! (NextTimeUpdate - current_time):SNTP_WAITPERIOD); } else { /* It's already time for us to update our time */ NextTimeUpdate = 0; *************** *** 517,524 **** /* Record the new server list */ sntp_num_servers = num_servers; ! if (num_servers == 0) server_list = NULL; sntp_servers = server_list; /* Free the mutex */ --- 518,529 ---- /* Record the new server list */ sntp_num_servers = num_servers; ! if (num_servers == 0) { server_list = NULL; + } else { + /* reset the waiting time to force a new update <= SNTP_WAITPERIOD*/ + NextTimeUpdate = 0; + } sntp_servers = server_list; /* Free the mutex */