From f5958971fb86ad95586feafc7a3d36e5f2637b47 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Wed, 29 May 2019 13:23:04 +0000
Subject: [PATCH] COB-66: Use timestamp of table.f0 in measures, not of
 directory (which doesnt actually change when measures are updated)

---
 RTCP/Cobalt/InputProc/src/Delays/Delays.cc | 4 +++-
 RTCP/Cobalt/InputProc/test/tDelays.cc      | 8 ++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/RTCP/Cobalt/InputProc/src/Delays/Delays.cc b/RTCP/Cobalt/InputProc/src/Delays/Delays.cc
index 3a43bcc62fb..41bac56e8c0 100644
--- a/RTCP/Cobalt/InputProc/src/Delays/Delays.cc
+++ b/RTCP/Cobalt/InputProc/src/Delays/Delays.cc
@@ -132,7 +132,9 @@ namespace LOFAR
       // obtain table last modification on file system
       struct stat filestats;
 
-      if (stat(resolved_path, &filestats) != 0)
+      string tablef0 = string(resolved_path) + "/table.f0";
+
+      if (stat(tablef0.c_str(), &filestats) != 0)
         THROW_SYSCALL("stat(): Cannot access IERSeop97 table");
 
       result.last_fs_modification = filestats.st_mtime;
diff --git a/RTCP/Cobalt/InputProc/test/tDelays.cc b/RTCP/Cobalt/InputProc/test/tDelays.cc
index 5bb2cca2454..e1414cb9635 100644
--- a/RTCP/Cobalt/InputProc/test/tDelays.cc
+++ b/RTCP/Cobalt/InputProc/test/tDelays.cc
@@ -26,6 +26,7 @@
 
 #include <Common/LofarLogger.h>
 #include <Stream/FixedBufferStream.h>
+#include <CoInterface/TimeFuncs.h>
 
 #include <InputProc/Delays/Delays.h>
 
@@ -131,6 +132,13 @@ int main()
 {
   INIT_LOGGER( "tDelays" );
 
+  // IERS table information
+  struct Delays::IERS_tablestats stats = Delays::get_IERS_tablestats();
+
+  LOG_INFO_STR("Using IERS table " << stats.realpath
+            << ", last entry is " << TimeDouble::toString(stats.last_entry_timestamp, false)
+            << ", table written on " << TimeDouble::toString(stats.last_fs_modification, false));
+
   return UnitTest::RunAllTests() > 0;
 }
 
-- 
GitLab