diff options
author | Vincent Blut <vincent.debian@free.fr> | 2017-01-16 17:37:59 +0100 |
---|---|---|
committer | Vincent Blut <vincent.debian@free.fr> | 2017-01-16 17:37:59 +0100 |
commit | 7095e70bea486d51b3d303ef2e4eed61628970f4 (patch) | |
tree | b4fa2368d2eb6b1aed7766e7d263e1787c30677d /sys_netbsd.c | |
parent | 53e3fdbcd5a0daa3dba21532d87fe65c048a9dd9 (diff) |
New upstream version 3.0
Diffstat (limited to 'sys_netbsd.c')
-rw-r--r-- | sys_netbsd.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys_netbsd.c b/sys_netbsd.c index 407be84..74cadbc 100644 --- a/sys_netbsd.c +++ b/sys_netbsd.c @@ -60,6 +60,7 @@ static void accrue_offset(double offset, double corr_rate) { struct timeval newadj, oldadj; + double doldadj; UTI_DoubleToTimeval(-offset, &newadj); @@ -67,9 +68,9 @@ accrue_offset(double offset, double corr_rate) LOG_FATAL(LOGF_SysNetBSD, "adjtime() failed"); /* Add the old remaining adjustment if not zero */ - UTI_TimevalToDouble(&oldadj, &offset); - if (offset != 0.0) { - UTI_AddDoubleToTimeval(&newadj, offset, &newadj); + doldadj = UTI_TimevalToDouble(&oldadj); + if (doldadj != 0.0) { + UTI_DoubleToTimeval(-offset + doldadj, &newadj); if (PRV_AdjustTime(&newadj, NULL) < 0) LOG_FATAL(LOGF_SysNetBSD, "adjtime() failed"); } @@ -78,7 +79,7 @@ accrue_offset(double offset, double corr_rate) /* ================================================== */ static void -get_offset_correction(struct timeval *raw, +get_offset_correction(struct timespec *raw, double *corr, double *err) { struct timeval remadj; @@ -87,7 +88,7 @@ get_offset_correction(struct timeval *raw, if (PRV_AdjustTime(NULL, &remadj) < 0) LOG_FATAL(LOGF_SysNetBSD, "adjtime() failed"); - UTI_TimevalToDouble(&remadj, &adjustment_remaining); + adjustment_remaining = UTI_TimevalToDouble(&remadj); *corr = adjustment_remaining; if (err) { |