1.00.26
C++ Standard Airline IT Object Library
Toggle main menu visibility
Loading...
Searching...
No Matches
BasChronometer.cpp
Go to the documentation of this file.
1
// //////////////////////////////////////////////////////////////////////
2
// Import section
3
// //////////////////////////////////////////////////////////////////////
4
// STL
5
#include <cassert>
6
// Stdair
7
#include <
stdair/basic/BasChronometer.hpp
>
8
9
namespace
stdair
{
10
11
// //////////////////////////////////////////////////////////////////////
12
BasChronometer::BasChronometer
() : _startTimeLaunched (false) {
13
}
14
15
// //////////////////////////////////////////////////////////////////////
16
void
BasChronometer::start
() {
17
// Get the time-stamp of now, and store it for later use
18
_startTime = boost::posix_time::microsec_clock::local_time();
19
20
// Update the boolean which states whether the chronometer
21
// is launched
22
_startTimeLaunched =
true
;
23
}
24
25
// //////////////////////////////////////////////////////////////////////
26
double
BasChronometer::elapsed
()
const
{
27
assert (_startTimeLaunched ==
true
);
28
29
// Get the time-stamp of now
30
const
boost::posix_time::ptime lStopTime =
31
boost::posix_time::microsec_clock::local_time();
32
33
// Calculate the time elapsed since the last time-stamp
34
const
boost::posix_time::time_duration lElapsedTime =
35
lStopTime - _startTime;
36
37
// Derived the corresponding number of milliseconds
38
const
double
lElapsedTimeInMicroSeconds =
39
static_cast<
const
double
>
(lElapsedTime.total_microseconds());
40
41
// The elapsed time given in return is expressed in seconds
42
return
(lElapsedTimeInMicroSeconds / 1e6);
43
}
44
45
}
BasChronometer.hpp
stdair
Handle on the StdAir library context.
Definition
BasChronometer.cpp:9
stdair::BasChronometer::elapsed
double elapsed() const
Definition
BasChronometer.cpp:26
stdair::BasChronometer::start
void start()
Definition
BasChronometer.cpp:16
stdair::BasChronometer::BasChronometer
BasChronometer()
Definition
BasChronometer.cpp:12
Generated for StdAir by
1.17.0