summaryrefslogtreecommitdiffstats
path: root/src/ClockTAI.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-06-16 11:08:39 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-06-16 11:08:39 +0200
commitb3bc56c30ee55d8ad32ae6f86de51c21336f1151 (patch)
tree2582a4874d1ebc43f58d2b3acd6348aba3238fe9 /src/ClockTAI.h
parente9ba40d3cbcfe608f542e867e39828f922d62ccb (diff)
downloaddabmux-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.h17
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