Lugdunum  0.1.0
Clock.cpp
Go to the documentation of this file.
1 #include <lug/System/Clock.hpp>
2 
3 namespace lug {
4 namespace System {
5 
6 Clock::Clock() : _startTime(Time::getCurrentTime()) {}
7 
8 Clock::Clock(const Clock& clock)
9 {
10  _startTime = clock._startTime;
11 }
12 
14 {
15  _startTime = clock._startTime;
16 }
17 
19 {
20  _startTime = clock._startTime;
21  return *this;
22 }
23 
25 {
26  _startTime = clock._startTime;
27  return *this;
28 }
29 
31  return Time(Time::getCurrentTime().getMicroseconds() - _startTime.getMicroseconds());
32 }
33 
35  auto old = Time(Time::getCurrentTime().getMicroseconds() - _startTime.getMicroseconds());
36 
38  return old;
39 }
40 
41 } // System
42 } // lug
Clock & operator=(const Clock &clock)
Definition: Clock.cpp:18
Time getElapsedTime() const
Definition: Clock.cpp:30
int64_t getMicroseconds() const
Definition: Time.inl:1
static Time getCurrentTime()
Definition: Time.cpp:11