V-ART
time.h
Go to the documentation of this file.
1 
5 #ifndef VART_TIME_H
6 #define VART_TIME_H
7 
8 #include <iostream>
9 
10 namespace VART {
15  class Time {
16  friend std::ostream& operator<<(std::ostream& output, const Time& t);
17  public:
18  // PUBLIC TYPES
19  // PUBLIC METHODS
21  Time();
23  Time(const Time& t);
25  Time(double newSeconds);
32  void Set();
34  unsigned int WholeMicroseconds() const;
36  unsigned int WholeMilliseconds() const;
38  unsigned int WholeSeconds() const;
40  float AsFloat() const { return static_cast<float>(seconds); }
41  // PUBLIC OPERATORS
42  Time operator-(const Time& initialTime) const;
43  bool operator>=(const Time& t) const { return seconds >= t.seconds; }
44  bool operator<=(const Time& t) const { return seconds <= t.seconds; }
45  bool operator>(const Time& t) const { return seconds > t.seconds; }
46  bool operator<(const Time& t) const { return seconds < t.seconds; }
47  void operator+=(double secs) { seconds += secs; }
48  void operator-=(const Time& t) { seconds -= t.seconds; }
49  // PUBLIC STATIC METHODS
54  static const Time& NOW();
55  protected:
57  double seconds;
58  private:
59  }; // end class declaration
60 } // end namespace
61 
62 #endif
Time operator-(const Time &initialTime) const
Definition: time.cpp:44
static const Time & NOW()
Returns current time.
Definition: time.cpp:68
Time()
Creates an unitialized object.
Definition: time.cpp:17
bool operator<=(const Time &t) const
Definition: time.h:44
bool operator>(const Time &t) const
Definition: time.h:45
void operator-=(const Time &t)
Definition: time.h:48
void Set()
Set to current time.
Definition: time.cpp:49
void operator+=(double secs)
Definition: time.h:47
double seconds
Number of seconds in elapsed time.
Definition: time.h:57
bool operator<(const Time &t) const
Definition: time.h:46
unsigned int WholeMicroseconds() const
Returns the number of whole microseconds in elapsed time.
Definition: time.cpp:29
float AsFloat() const
Returns elapsed time (number of seconds) as float.
Definition: time.h:40
bool operator>=(const Time &t) const
Definition: time.h:43
unsigned int WholeSeconds() const
Returns the number of whole seconds in elapsed time.
Definition: time.cpp:39
friend std::ostream & operator<<(std::ostream &output, const Time &t)
unsigned int WholeMilliseconds() const
Returns the number of whole miliseconds in elapsed time.
Definition: time.cpp:34
Elapsed time representation.
Definition: time.h:15