Definition at line 21 of file Time.h.
◆ Time() [1/3]
Definition at line 23 of file Time.cc.
24{
25 timeval tv;
26 gettimeofday(&tv, 0);
27 m_s = tv.tv_sec;
28 m_us = tv.tv_usec;
29}
◆ Time() [2/3]
◆ Time() [3/3]
Time |
( |
const long |
s, |
|
|
const long |
us |
|
) |
| |
Definition at line 36 of file Time.cc.
37 : m_s(s), m_us(us)
38{
39 adjust();
40}
◆ ~Time()
◆ adjust()
Definition at line 46 of file Time.cc.
47{
48 if (MEGA <= labs(m_us)) {
49 m_s += m_us / MEGA;
50 m_us = m_us - (m_us / MEGA) * MEGA;
51 }
52 if (0 < m_s && m_us < 0) {
53 m_s--;
54 m_us += MEGA;
55 }
56 if (m_s < 0 && 0 < m_us) {
57 m_s++;
58 m_us -= MEGA;
59 }
60}
◆ clear()
Definition at line 62 of file Time.cc.
63{
64 m_s = m_us = 0;
65}
◆ get()
Definition at line 91 of file Time.cc.
92{
93 return (double)m_s + ((double)m_us) / 1000000.;
94}
◆ getMicroSecond()
long getMicroSecond |
( |
| ) |
const |
Definition at line 101 of file Time.cc.
102{
103 return m_us;
104}
◆ getSecond()
◆ operator+()
Definition at line 130 of file Time.cc.
131{
133 tt.m_s += t.m_s;
134 tt.m_us += t.m_us;
135 return tt;
136}
◆ operator-()
Definition at line 138 of file Time.cc.
139{
141 tt.m_s -= t.m_s;
142 tt.m_us -= t.m_us;
143 return tt;
144}
◆ operator==()
bool operator== |
( |
const Time & |
t | ) |
const |
Definition at line 125 of file Time.cc.
126{
127 return (m_s == t.m_s) && (m_us == t.m_us);
128}
◆ readObject()
Implements Serializable.
Definition at line 113 of file Time.cc.
114{
115 m_s = r.readLong();
116 m_us = r.readLong();
117}
◆ set() [1/3]
Definition at line 67 of file Time.cc.
68{
69 timeval tv;
70 gettimeofday(&tv, 0);
71 m_s = tv.tv_sec;
72 m_us = tv.tv_usec;
73}
◆ set() [2/3]
void set |
( |
const double |
t | ) |
|
Definition at line 75 of file Time.cc.
76{
77 double s, us;
78 us = modf(t, &s);
79 m_s = (long)s;
80 m_us = (long)(us * 1000000);
81 adjust();
82}
◆ set() [3/3]
void set |
( |
const long |
s, |
|
|
const long |
us |
|
) |
| |
Definition at line 84 of file Time.cc.
85{
86 m_s = s;
87 m_us = us;
88 adjust();
89}
◆ toString()
std::string toString |
( |
| ) |
const |
Definition at line 106 of file Time.cc.
107{
108 std::stringstream ss;
109 ss << m_s << "." << m_us;
110 return ss.str();
111}
◆ writeObject()
void writeObject |
( |
Writer & |
w | ) |
const |
|
overridevirtual |
Implements Serializable.
Definition at line 119 of file Time.cc.
120{
121 w.writeLong(m_s);
122 w.writeLong(m_us);
123}
◆ m_s
◆ m_us
The documentation for this class was generated from the following files: