diff --git a/client.c b/client.c index 899732f..8cccc75 100644 --- a/client.c +++ b/client.c @@ -1015,7 +1015,6 @@ process_cmd_password(CMD_Request *msg, char *line) { char *p, *q; char *password; - struct timezone tz; struct timeval now; p = line; @@ -1049,7 +1048,7 @@ process_cmd_password(CMD_Request *msg, char *line) *p = 0; } - if (gettimeofday(&now, &tz) < 0) { + if (gettimeofday(&now, NULL) < 0) { printf("500 - Could not read time of day\n"); return 0; } else { diff --git a/local.c b/local.c index f0ca964..64d635b 100644 --- a/local.c +++ b/local.c @@ -104,16 +104,15 @@ static void calculate_sys_precision(void) { struct timeval tv, old_tv, first_tv; - struct timezone tz; int dusec, best_dusec; int iters; - gettimeofday(&old_tv, &tz); + gettimeofday(&old_tv, NULL); first_tv = old_tv; best_dusec = 1000000; /* Assume we must be better than a second */ iters = 0; do { - gettimeofday(&tv, &tz); + gettimeofday(&tv, NULL); dusec = 1000000*(tv.tv_sec - old_tv.tv_sec) + (tv.tv_usec - old_tv.tv_usec); old_tv = tv; if (dusec > 0) { @@ -311,9 +310,7 @@ void LCL_RemoveDispersionNotifyHandler(LCL_DispersionNotifyHandler handler, void void LCL_ReadRawTime(struct timeval *result) { - struct timezone tz; - - if (gettimeofday(result, &tz) < 0) { + if (gettimeofday(result, NULL) < 0) { LOG_FATAL(LOGF_Local, "gettimeofday() failed"); } } diff --git a/sys_linux.c b/sys_linux.c index fe326f1..535e52d 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -215,13 +215,12 @@ static int tick_update_hz; static void update_slow_slew_error(int offset) { - struct timezone tz; struct timeval now, newend; if (offset == 0 && slow_slew_error == 0) return; - if (gettimeofday(&now, &tz) < 0) { + if (gettimeofday(&now, NULL) < 0) { LOG_FATAL(LOGF_SysLinux, "gettimeofday() failed"); } @@ -264,7 +263,6 @@ get_slow_slew_error(struct timeval *now) static void update_nano_slew_error(long offset, int new) { - struct timezone tz; struct timeval now; double ago; @@ -278,7 +276,7 @@ update_nano_slew_error(long offset, int new) offset = -offset; if (new || nano_slew_error_start.tv_sec > 0) { - if (gettimeofday(&now, &tz) < 0) { + if (gettimeofday(&now, NULL) < 0) { LOG_FATAL(LOGF_SysLinux, "gettimeofday() failed"); } } @@ -352,7 +350,6 @@ static void stop_fast_slew(void) { struct timeval T1; - struct timezone tz; double fast_slew_done; double slew_duration; @@ -360,7 +357,7 @@ stop_fast_slew(void) assert(fast_slewing); /* Now set the thing off */ - if (gettimeofday(&T1, &tz) < 0) { + if (gettimeofday(&T1, NULL) < 0) { LOG_FATAL(LOGF_SysLinux, "gettimeofday() failed"); } @@ -393,12 +390,11 @@ static void adjust_fast_slew(double old_tick, double old_delta_tick) { struct timeval tv, end_of_slew; - struct timezone tz; double fast_slew_done, slew_duration, dseconds; assert(fast_slewing); - if (gettimeofday(&tv, &tz) < 0) { + if (gettimeofday(&tv, NULL) < 0) { LOG_FATAL(LOGF_SysLinux, "gettimeofday() failed"); } @@ -432,7 +428,6 @@ initiate_slew(void) long offset; struct timeval T0; struct timeval end_of_slew; - struct timezone tz; /* Don't want to get here if we already have an adjust on the go! */ assert(!fast_slewing); @@ -519,7 +514,7 @@ initiate_slew(void) dseconds = - offset_register * (current_total_tick + delta_total_tick) / delta_total_tick; /* Now set the thing off */ - if (gettimeofday(&T0, &tz) < 0) { + if (gettimeofday(&T0, NULL) < 0) { LOG_FATAL(LOGF_SysLinux, "gettimeofday() failed"); } @@ -604,24 +599,23 @@ static void apply_step_offset(double offset) { struct timeval old_time, new_time; - struct timezone tz; double err; if (fast_slewing) { abort_slew(); } - if (gettimeofday(&old_time, &tz) < 0) { + if (gettimeofday(&old_time, NULL) < 0) { LOG_FATAL(LOGF_SysLinux, "gettimeofday() failed"); } UTI_AddDoubleToTimeval(&old_time, -offset, &new_time); - if (settimeofday(&new_time, &tz) < 0) { + if (settimeofday(&new_time, NULL) < 0) { LOG_FATAL(LOGF_SysLinux, "settimeofday() failed"); } - if (gettimeofday(&old_time, &tz) < 0) { + if (gettimeofday(&old_time, NULL) < 0) { LOG_FATAL(LOGF_SysLinux, "gettimeofday() failed"); } diff --git a/sys_netbsd.c b/sys_netbsd.c index f998bdf..0e4acb4 100644 --- a/sys_netbsd.c +++ b/sys_netbsd.c @@ -78,13 +78,12 @@ static void clock_initialise(void) { struct timeval newadj, oldadj; - struct timezone tz; offset_register = 0.0; adjustment_requested = 0.0; current_freq = 0.0; - if (gettimeofday(&T0, &tz) < 0) { + if (gettimeofday(&T0, NULL) < 0) { LOG_FATAL(LOGF_SysNetBSD, "gettimeofday() failed"); } @@ -113,7 +112,6 @@ start_adjust(void) { struct timeval newadj, oldadj; struct timeval T1; - struct timezone tz; double elapsed, accrued_error; double adjust_required; struct timeval exact_newadj; @@ -122,7 +120,7 @@ start_adjust(void) double old_adjust_remaining; /* Determine the amount of error built up since the last adjustment */ - if (gettimeofday(&T1, &tz) < 0) { + if (gettimeofday(&T1, NULL) < 0) { LOG_FATAL(LOGF_SysNetBSD, "gettimeofday() failed"); } @@ -169,7 +167,6 @@ static void stop_adjust(void) { struct timeval T1; - struct timezone tz; struct timeval zeroadj, remadj; double adjustment_remaining, adjustment_achieved; double elapsed, elapsed_plus_adjust; @@ -181,7 +178,7 @@ stop_adjust(void) LOG_FATAL(LOGF_SysNetBSD, "adjtime() failed"); } - if (gettimeofday(&T1, &tz) < 0) { + if (gettimeofday(&T1, NULL) < 0) { LOG_FATAL(LOGF_SysNetBSD, "gettimeofday() failed"); } @@ -221,17 +218,16 @@ static void apply_step_offset(double offset) { struct timeval old_time, new_time, T1; - struct timezone tz; stop_adjust(); - if (gettimeofday(&old_time, &tz) < 0) { + if (gettimeofday(&old_time, NULL) < 0) { LOG_FATAL(LOGF_SysNetBSD, "gettimeofday() failed"); } UTI_AddDoubleToTimeval(&old_time, -offset, &new_time); - if (settimeofday(&new_time, &tz) < 0) { + if (settimeofday(&new_time, NULL) < 0) { LOG_FATAL(LOGF_SysNetBSD, "settimeofday() failed"); } diff --git a/sys_solaris.c b/sys_solaris.c index 44ea0b7..8de9810 100644 --- a/sys_solaris.c +++ b/sys_solaris.c @@ -94,13 +94,12 @@ static void clock_initialise(void) { struct timeval newadj, oldadj; - struct timezone tz; offset_register = 0.0; adjustment_requested = 0.0; current_freq = 0.0; - if (gettimeofday(&T0, &tz) < 0) { + if (gettimeofday(&T0, NULL) < 0) { LOG_FATAL(LOGF_SysSolaris, "gettimeofday() failed"); } @@ -135,7 +134,6 @@ start_adjust(void) { struct timeval newadj, oldadj; struct timeval T1; - struct timezone tz; double elapsed, accrued_error; double adjust_required; struct timeval exact_newadj; @@ -143,7 +141,7 @@ start_adjust(void) double old_adjust_remaining; /* Determine the amount of error built up since the last adjustment */ - if (gettimeofday(&T1, &tz) < 0) { + if (gettimeofday(&T1, NULL) < 0) { LOG_FATAL(LOGF_SysSolaris, "gettimeofday() failed"); } @@ -182,7 +180,6 @@ static void stop_adjust(void) { struct timeval T1; - struct timezone tz; struct timeval zeroadj, remadj; double adjustment_remaining, adjustment_achieved; double elapsed, elapsed_plus_adjust; @@ -194,7 +191,7 @@ stop_adjust(void) LOG_FATAL(LOGF_SysSolaris, "adjtime() failed"); } - if (gettimeofday(&T1, &tz) < 0) { + if (gettimeofday(&T1, NULL) < 0) { LOG_FATAL(LOGF_SysSolaris, "gettimeofday() failed"); } @@ -235,10 +232,9 @@ apply_step_offset(double offset) { struct timeval old_time, new_time, rounded_new_time, T1; double rounding_error; - struct timezone tz; stop_adjust(); - if (gettimeofday(&old_time, &tz) < 0) { + if (gettimeofday(&old_time, NULL) < 0) { LOG_FATAL(LOGF_SysSolaris, "gettimeofday() failed"); } @@ -259,7 +255,7 @@ apply_step_offset(double offset) UTI_DiffTimevalsToDouble(&rounding_error, &rounded_new_time, &new_time); - if (settimeofday(&new_time, &tz) < 0) { + if (settimeofday(&new_time, NULL) < 0) { LOG_FATAL(LOGF_SysSolaris, "settimeofday() failed"); } diff --git a/sys_sunos.c b/sys_sunos.c index 0898af8..d1c98a3 100644 --- a/sys_sunos.c +++ b/sys_sunos.c @@ -84,13 +84,12 @@ static void clock_initialise(void) { struct timeval newadj, oldadj; - struct timezone tz; offset_register = 0.0; adjustment_requested = 0.0; current_freq = 0.0; - if (gettimeofday(&T0, &tz) < 0) { + if (gettimeofday(&T0, NULL) < 0) { LOG_FATAL(LOGF_SysSunOS, "gettimeofday() failed"); } @@ -126,7 +125,6 @@ start_adjust(void) { struct timeval newadj, oldadj; struct timeval T1; - struct timezone tz; double elapsed, accrued_error; double adjust_required; struct timeval exact_newadj; @@ -135,7 +133,7 @@ start_adjust(void) long remainder, multiplier; /* Determine the amount of error built up since the last adjustment */ - if (gettimeofday(&T1, &tz) < 0) { + if (gettimeofday(&T1, NULL) < 0) { LOG_FATAL(LOGF_SysSunOS, "gettimeofday() failed"); } @@ -185,7 +183,6 @@ static void stop_adjust(void) { struct timeval T1; - struct timezone tz; struct timeval zeroadj, remadj; double adjustment_remaining, adjustment_achieved; double gap; @@ -198,7 +195,7 @@ stop_adjust(void) LOG_FATAL(LOGF_SysSunOS, "adjtime() failed"); } - if (gettimeofday(&T1, &tz) < 0) { + if (gettimeofday(&T1, NULL) < 0) { LOG_FATAL(LOGF_SysSunOS, "gettimeofday() failed"); } @@ -238,16 +235,15 @@ static void apply_step_offset(double offset) { struct timeval old_time, new_time, T1; - struct timezone tz; stop_adjust(); - if (gettimeofday(&old_time, &tz) < 0) { + if (gettimeofday(&old_time, NULL) < 0) { LOG_FATAL(LOGF_SysSunOS, "gettimeofday() failed"); } UTI_AddDoubleToTimeval(&old_time, -offset, &new_time); - if (settimeofday(&new_time, &tz) < 0) { + if (settimeofday(&new_time, NULL) < 0) { LOG_FATAL(LOGF_SysSunOS, "settimeofday() failed"); } diff --git a/util.c b/util.c index 500ef70..aec5fd0 100644 --- a/util.c +++ b/util.c @@ -506,9 +506,8 @@ UTI_TimevalNetworkToHost(Timeval *src, struct timeval *dest) is only 32-bit */ if (sizeof (time_t) > 4 && sec_high == TV_NOHIGHSEC) { struct timeval now; - struct timezone tz; - gettimeofday(&now, &tz); + gettimeofday(&now, NULL); sec_high = now.tv_sec >> 16 >> 16; } dest->tv_sec = (time_t)sec_high << 16 << 16 | sec_low;