From 82bf231d416d3c42f33e85d201122f33c6d3644c Mon Sep 17 00:00:00 2001
From: Tommaso <tommaso@nyx.cern.ch>
Date: Sat, 5 Mar 2016 16:16:28 +0100
Subject: [PATCH] Activity: use correct time units in rate control code

---
 src/Activity.cxx | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/Activity.cxx b/src/Activity.cxx
index f28478a..a963c56 100644
--- a/src/Activity.cxx
+++ b/src/Activity.cxx
@@ -51,7 +51,7 @@ namespace {
   {
     timespec ts;
     clock_gettime(CLOCK_MONOTONIC, &ts);
-    return std::uint64_t(ts.tv_sec) * 1000000000 + std::uint64_t(ts.tv_nsec);
+    return std::uint64_t(ts.tv_sec) * 1000ull * 1000ull * 1000ull + std::uint64_t(ts.tv_nsec);
   }
 }
 
@@ -362,9 +362,9 @@ namespace hltsv {
   {
     ERS_LOG("Starting l1 thread");
 
-    const std::uint64_t ms = 1000ull;
-    const std::uint64_t s = 1000ull * 1000ull;
-    std::uint64_t deadline = ns() + m_event_delay * ms;
+    const std::uint64_t us = 1000ull;
+    const std::uint64_t s = 1000ull * 1000ull * 1000ull;
+    std::uint64_t deadline = ns() + m_event_delay * us;
 
     uint64_t m_assigned = 0;   // counter of events from L1Source
 
@@ -390,7 +390,7 @@ namespace hltsv {
         }
         
         std::uint64_t now = ns();
-        std::uint64_t period = m_event_delay * ms;
+        std::uint64_t period = m_event_delay * us;
         if (period != 0) {
           if (now > deadline + 1 * s) {
             // We overshot the deadline by more than 1 s. 
-- 
GitLab