summaryrefslogtreecommitdiffstats
path: root/src/host/trxcon/scheduler.h
diff options
context:
space:
mode:
authorStefan Sperling <ssperling@sysmocom.de>2018-08-17 14:38:01 +0200
committerVadim Yanitskiy <axilirator@gmail.com>2018-08-17 17:22:59 +0000
commit316f22f057d7d2063a2d33ac157e848eba590ecb (patch)
tree385084a7f1e5dd86bd140381b353d6ee2845b588 /src/host/trxcon/scheduler.h
parent347406cee7f4ea1094b0af0ff92da6c4835aa37f (diff)
trxcon/sched_clck.c: fix time delta calculations
Use osmo_clock_gettime() to read the monotonic clock instead of gettimeofday() which could drift backwards. This requires switching the scheduler clock from struct timeval to struct timespec. Expand some variables to 64 bits in order to keep types used in calculations compatible. The previous implementation unconditionally subtracted microsecond values from different time measurements, causing overflow if the current measurement was taken in less of a fraction of a second than the past measurement. Use timespecsub() for the subtraction instead which accounts for fractions of a second correctly. Change-Id: Ic93f90685c6d6dc28dfc4ad48c998e0eac113cf8 Related: OS#3467
Diffstat (limited to 'src/host/trxcon/scheduler.h')
-rw-r--r--src/host/trxcon/scheduler.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/host/trxcon/scheduler.h b/src/host/trxcon/scheduler.h
index f36c3b2b..6c3a2f20 100644
--- a/src/host/trxcon/scheduler.h
+++ b/src/host/trxcon/scheduler.h
@@ -21,7 +21,7 @@ struct trx_sched {
/*! \brief Clock state */
uint8_t state;
/*! \brief Local clock source */
- struct timeval clock;
+ struct timespec clock;
/*! \brief Count of processed frames */
uint32_t fn_counter_proc;
/*! \brief Local frame counter advance */