mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 16:25:07 -05:00
adopt struct timespec
Replace struct timeval with struct timespec as the main data type for timestamps. This will allow the NTP code to work with timestamps in nanosecond resolution.
This commit is contained in:
@@ -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);
|
||||
UTI_TimevalToDouble(&oldadj, &doldadj);
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user