summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Reiss <jreiss@multitech.com>2022-12-21 10:14:57 -0600
committerJason Reiss <jreiss@multitech.com>2022-12-21 10:14:57 -0600
commitd4b8361467375abf8173e865a9c7416450db538f (patch)
treeb18b75190ad30ef098dbf01ec1c5281dceba0ce4
parent70a1a032ec437864c806ee76719bbc24ebdc8300 (diff)
downloadlora_gateway_mtac_full-master.tar.gz
lora_gateway_mtac_full-master.tar.bz2
lora_gateway_mtac_full-master.zip
Bugfix: Calculate tmst diff over rollover correctly for cnt2utc and cnt2gpsHEAD5.0.22master
-rw-r--r--libloragw/src/loragw_gps.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libloragw/src/loragw_gps.c b/libloragw/src/loragw_gps.c
index bb37e1b..3a886f3 100644
--- a/libloragw/src/loragw_gps.c
+++ b/libloragw/src/loragw_gps.c
@@ -721,7 +721,7 @@ int lgw_cnt2utc(struct tref ref, uint32_t count_us, struct timespec *utc) {
/* calculate delta in seconds between reference count_us and target count_us
calculate rollover diff, uint32 difference is OK */
- if (count_us > ref.count_us || ((ref.count_us & 0xFF000000) == 0xFF000000) && ((count_us & 0xFF000000) == 0))
+ if (count_us > ref.count_us || ((ref.count_us & 0xFF000000) == 0xFF000000) && ((count_us & 0xFF000000) == 0)) {
delta_sec = (double)(count_us - ref.count_us) / (TS_CPS * ref.xtal_err);
} else {
delta_sec = -(double)(ref.count_us - count_us) / (TS_CPS * ref.xtal_err);