diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-08-22 20:42:34 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-08-22 20:42:34 +0200 |
commit | 289f61e5023758f1ca805d19be5f2c19757090e3 (patch) | |
tree | 49577f82f450d56f2962ecbfbd0237034774a2c2 /src/utils.cpp | |
parent | 1f4a861853f37fccbd0aa25a9f1b6457117ee85c (diff) | |
download | dabmux-289f61e5023758f1ca805d19be5f2c19757090e3.tar.gz dabmux-289f61e5023758f1ca805d19be5f2c19757090e3.tar.bz2 dabmux-289f61e5023758f1ca805d19be5f2c19757090e3.zip |
Switch FIG0/10 to long form
The latest draft specification deprecates the short form, and most
muxes today used the long form.
Diffstat (limited to 'src/utils.cpp')
-rw-r--r-- | src/utils.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/utils.cpp b/src/utils.cpp index ec3e0c7..7221453 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -3,8 +3,8 @@ 2011, 2012 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2013, 2014, 2015 Matthias P. Braendli - http://mpb.li + Copyright (C) 2016 + Matthias P. Braendli, matthias.braendli@mpb.li */ /* This file is part of ODR-DabMux. @@ -31,20 +31,26 @@ using namespace std; -time_t getDabTime() +static time_t dab_time_seconds = 0; +static int dab_time_millis = 0; + +void update_dab_time() { - static time_t oldTime = 0; - static int offset = 0; - if (oldTime == 0) { - oldTime = time(NULL); + if (dab_time_seconds == 0) { + dab_time_seconds = time(NULL); } else { - offset+= 24; - if (offset >= 1000) { - offset -= 1000; - ++oldTime; + dab_time_millis+= 24; + if (dab_time_millis >= 1000) { + dab_time_millis -= 1000; + ++dab_time_seconds; } } - return oldTime; +} + +void get_dab_time(time_t *time, uint32_t *millis) +{ + *time = dab_time_seconds; + *millis = dab_time_millis; } |