From 4e3843a502dd3cecb40d52221e8feafc8213b47c Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Fri, 8 Jun 2012 13:11:39 +0200 Subject: [PATCH] [Positioner] Verbose Timestamp::update_current_time() --- owlps-positioner/src/input.cc | 7 +------ owlps-positioner/src/timestamp.cc | 11 ++++++++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/owlps-positioner/src/input.cc b/owlps-positioner/src/input.cc index b7967af..dc0e486 100644 --- a/owlps-positioner/src/input.cc +++ b/owlps-positioner/src/input.cc @@ -125,12 +125,7 @@ const Request& Input::get_next_request() const log_current_request() ; if (Configuration::is_configured("replay")) - { - Timestamp::update_current_time(request.get_time_sent()) ; - if (Configuration::is_configured("verbose")) - cerr << "Current time set to " - << Timestamp::get_current_time() << ".\n" ; - } + Timestamp::update_current_time(request.get_time_sent()) ; // If the request is a calibration request, add it to the Stock // (if allowed, and if it is not empty) diff --git a/owlps-positioner/src/timestamp.cc b/owlps-positioner/src/timestamp.cc index 73bf1c0..61b968f 100644 --- a/owlps-positioner/src/timestamp.cc +++ b/owlps-positioner/src/timestamp.cc @@ -9,7 +9,9 @@ #include "configuration.hh" #include +#include +using namespace std ; Timestamp Timestamp::current_time ; @@ -110,7 +112,14 @@ void Timestamp::update_current_time(const Timestamp &source) // According to human perception, time generally goes only forward: if (current_time < source) - current_time = source ; + { + current_time = source ; + if (Configuration::is_configured("verbose")) + cerr << "Current time set to " << current_time << ".\n" ; + } + else if (Configuration::is_configured("verbose")) + cerr << "Current time left unchanged to " << current_time + << " (time proposed: " << source << ").\n" ; }