diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-06-16 11:08:39 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-06-16 11:08:39 +0200 |
commit | b3bc56c30ee55d8ad32ae6f86de51c21336f1151 (patch) | |
tree | 2582a4874d1ebc43f58d2b3acd6348aba3238fe9 /src/ClockTAI.h | |
parent | e9ba40d3cbcfe608f542e867e39828f922d62ccb (diff) | |
download | dabmux-b3bc56c30ee55d8ad32ae6f86de51c21336f1151.tar.gz dabmux-b3bc56c30ee55d8ad32ae6f86de51c21336f1151.tar.bz2 dabmux-b3bc56c30ee55d8ad32ae6f86de51c21336f1151.zip |
EDI TIST: Add local file cache for leap second data
Diffstat (limited to 'src/ClockTAI.h')
-rw-r--r-- | src/ClockTAI.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/ClockTAI.h b/src/ClockTAI.h index ab70384..99827ba 100644 --- a/src/ClockTAI.h +++ b/src/ClockTAI.h @@ -59,7 +59,10 @@ class ClockTAI { #endif private: - int download_offset_task(void); + // Either retrieve the bulletin from the cache or if necessarly + // download it, and calculate the TAI-UTC offset. + // Returns the offset. + int get_valid_offset(void); // Download of new bulletin is done asynchronously std::future<int> m_offset_future; @@ -71,7 +74,17 @@ class ClockTAI { std::stringstream m_bulletin; std::chrono::system_clock::time_point m_bulletin_download_time; - // Load bulletin into m_bulletin + // Load bulletin into m_bulletin from the cache file + void load_bulletin_from_file(const char* cache_filename); + + // Update the cache file with the current m_bulletin + void update_cache(const char* cache_filename); + + // Verifies the expiration date in the m_bulletin. Returns + // true if the bulletin is valid. + bool bulletin_is_valid(void); + + // Load bulletin into m_bulletin from the URL void download_tai_utc_bulletin(const char* url); // read TAI offset from m_bulletin in IETF format |