lib/stopwatch.cpp
Go to the documentation of this file.
1 
9 /*****************************************************************************
10 ** Includes
11 *****************************************************************************/
12 
13 #include "../../include/ecl/time/timestamp.hpp"
14 #include "../../include/ecl/time/stopwatch.hpp"
15 #ifdef ECL_HAS_TIMESTAMP
16 
17 /*****************************************************************************
18 ** Namespaces
19 *****************************************************************************/
20 
21 namespace ecl {
22 
23 /*****************************************************************************
24 ** Implementation [StopWatch]
25 *****************************************************************************/
26 StopWatch::StopWatch() {
27  // The variable start_time will automatically initialise with the current
28  // system time.
29 };
30 
31 /*****************************************************************************
32 ** Implementation
33 *****************************************************************************/
34 
35 void StopWatch::restart()
36 {
37  start_time.stamp();
38  split_time = start_time;
39 }
40 
41 TimeStamp StopWatch::elapsed()
42 {
43  TimeStamp current_time; // Automatically fetches the current system time.
44  return ( current_time - start_time );
45 }
46 
47 TimeStamp StopWatch::split()
48 {
49  TimeStamp last_time = split_time;
50  split_time.stamp();
51  return (split_time - last_time);
52 }
53 
54 }; // namespace ecl
55 
56 #endif /* ECL_HAS_TIMESTAMP */
57 
ecl
Embedded control libraries.


ecl_time
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:19