diff options
author | Stefan Sperling <ssperling@sysmocom.de> | 2018-05-25 15:12:30 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-05-25 17:33:06 +0000 |
commit | f0f7df1b87c0c82fe39e543bf6c6e432c627218d (patch) | |
tree | f0197e16e99afdaf11decf0a678059f0fd62de60 /src/tbf.h | |
parent | 143b2da4f846acdcfccc9f1038d25f8a244a47de (diff) |
read monotonic clock with clock_gettime() instead of gettimeofday()
There have been test failures on the osmo-pcu Jenkins builders due
to apparent clock drift. Switch relevant code from gettimeofday()
to clock_gettime() with CLOCK_MONOTONIC to prevent time from going
backwards and causing negative time deltas in calculations.
Change-Id: I775d85d0d3ac740330879e588bdab6fce7f0b46c
Related: OS#3225
Diffstat (limited to 'src/tbf.h')
-rw-r--r-- | src/tbf.h | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -318,7 +318,7 @@ struct gprs_rlcmac_tbf { unsigned int num_fT_exp; /* number of consecutive fT expirations */ struct Meas { - struct timeval rssi_tv; /* timestamp for rssi calculation */ + struct timespec rssi_tv; /* timestamp for rssi calculation */ int32_t rssi_sum; /* sum of rssi values */ int rssi_num; /* number of rssi values added since rssi_tv */ @@ -665,11 +665,11 @@ struct gprs_rlcmac_dl_tbf : public gprs_rlcmac_tbf { int32_t m_last_dl_drained_fn; struct BandWidth { - struct timeval dl_bw_tv; /* timestamp for dl bw calculation */ + struct timespec dl_bw_tv; /* timestamp for dl bw calculation */ uint32_t dl_bw_octets; /* number of octets since bw_tv */ uint32_t dl_throughput; /* throughput to be displayed in stats */ - struct timeval dl_loss_tv; /* timestamp for loss calculation */ + struct timespec dl_loss_tv; /* timestamp for loss calculation */ uint16_t dl_loss_lost; /* sum of lost packets */ uint16_t dl_loss_received; /* sum of received packets */ |