NorMIT-nav  22.09
An IGT application
cxTimeKeeper.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 
13 #include "cxTimeKeeper.h"
14 #include "cxLogger.h"
15 #include "cxReporter.h"
16 
17 namespace cx
18 {
19 
20 TimeKeeper::TimeKeeper() : mTime(QDateTime::currentDateTime()) {}
21 
23 {
24  reporter()->sendDebug(text + ": " + this->getElapsedSecondsAsString() + "s");
25 }
26 void TimeKeeper::printElapsedms(QString text) const
27 {
28  reporter()->sendDebug(QString(text + ": %1").arg(getElapsedms()));
29 }
30 
32 {
33  double secs = double(this->getElapsedms())/1000;
34  return QString("%1").arg(secs, 0, 'f', 2);
35 }
37 {
38  return mTime.msecsTo(QDateTime::currentDateTime());
39 }
40 
42 {
43  mTime = QDateTime::currentDateTime();
44 }
45 
46 } // namespace cx
cx::TimeKeeper::TimeKeeper
TimeKeeper()
Definition: cxTimeKeeper.cpp:20
cxLogger.h
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::TimeKeeper::reset
void reset()
Definition: cxTimeKeeper.cpp:41
cx::TimeKeeper::getElapsedms
int getElapsedms() const
Definition: cxTimeKeeper.cpp:36
cx::TimeKeeper::getElapsedSecondsAsString
QString getElapsedSecondsAsString() const
Definition: cxTimeKeeper.cpp:31
cxReporter.h
cx::reporter
ReporterPtr reporter()
Definition: cxReporter.cpp:36
cxTimeKeeper.h
cx::TimeKeeper::printElapsedSeconds
void printElapsedSeconds(QString text="Elapsed time")
Definition: cxTimeKeeper.cpp:22
cx::TimeKeeper::printElapsedms
void printElapsedms(QString text="Elapsed") const
Definition: cxTimeKeeper.cpp:26