Thunderbots Project
Loading...
Searching...
No Matches
time.h
1#pragma once
2
3#include <time.h>
4
10class Time
11{
12 public:
13 // Due to internal representation of doubles being slightly less accurate/consistent
14 // with some numbers and operations, we consider Times that are very close
15 // together to be equal (since they likely are, just possibly slightly misrepresented
16 // by the system/compiler). We use this EPSILON as a threshold for comparison. 1e-15
17 // was chosen as a value because doubles have about 16 consistent significant figures.
18 // Comparing numbers with 15 significant figures gives us a
19 // small buffer while remaining as accurate as possible.
20 // http://www.cplusplus.com/forum/beginner/95128/
21 static constexpr double EPSILON = 1e-15;
22
26 Time();
27
33 double toSeconds() const;
34
40 double toMilliseconds() const;
41
51 virtual ~Time() = 0;
52
53 protected:
60 explicit Time(double time_seconds);
61
62 // The stored internal value of the Time, in seconds
63 double time_in_seconds;
64};
Definition time.h:11
double toSeconds() const
Definition time.cpp:12
Time()
Definition time.cpp:5
virtual ~Time()=0
Definition time.cpp:22
double toMilliseconds() const
Definition time.cpp:17