GCC Code Coverage Report


Directory: src/gate/
File: src/gate/cxx_times.cpp
Date: 2026-03-20 22:56:14
Exec Total Coverage
Lines: 281 282 99.6%
Functions: 93 93 100.0%
Branches: 82 180 45.6%

Line Branch Exec Source
1 /* GATE PROJECT LICENSE:
2 +----------------------------------------------------------------------------+
3 | Copyright (c) 2018-2026, Stefan Meislinger <sm@opengate.at> |
4 | All rights reserved. |
5 | |
6 | Redistribution and use in source and binary forms, with or without |
7 | modification, are permitted provided that the following conditions are met:|
8 | |
9 | 1. Redistributions of source code must retain the above copyright notice, |
10 | this list of conditions and the following disclaimer. |
11 | 2. Redistributions in binary form must reproduce the above copyright |
12 | notice, this list of conditions and the following disclaimer in the |
13 | documentation and/or other materials provided with the distribution. |
14 | |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"|
16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
25 | THE POSSIBILITY OF SUCH DAMAGE. |
26 +----------------------------------------------------------------------------+
27 */
28
29 #include "gate/times.hpp"
30 #include "gate/results.hpp"
31
32 namespace gate
33 {
34
35
36 32 Time::Time(timestamp_t microsince1601, int32_t biasminutes)
37 {
38 32 gate_time_t& t = *this;
39 32 gate_mem_clear(&t, sizeof(t));
40 32 t.timestamp = microsince1601;
41 32 t.bias = biasminutes;
42 32 }
43 25 Time::Time(gate_time_t const& src)
44 25 : gate_time_t(src)
45 {
46 25 }
47
48
49 7 Time Time::now()
50 {
51
1/2
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
7 Time tm;
52
1/2
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
7 result_t result = gate_time_now(&tm);
53
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
7 GATEXX_CHECK_ERROR(result);
54 7 return tm;
55 }
56
57 1 DateTime Time::toDateTime() const
58 {
59 1 DateTime ret;
60
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 result_t result = gate_time_to_datetime(this, static_cast<gate_datetime_t*>(&ret));
61
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_ERROR(result);
62 1 return ret;
63 }
64
65 1 String Time::toString() const
66 {
67 char buffer[1024];
68 1 size_t bufferlen = sizeof(buffer);
69
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 result_t result = gate_time_to_string(this, NULL, buffer, &bufferlen);
70
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_ERROR(result);
71
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 return String(buffer, bufferlen);
72 }
73 1 String Time::toString(String const& format) const
74 {
75 char pattern[1024];
76 char buffer[1024];
77 1 size_t bufferlen = sizeof(buffer);
78 1 gate_time_t const* ptr_time = this;
79
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 format.copyTo(pattern, sizeof(pattern));
80
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 result_t result = gate_time_to_string(ptr_time, pattern, buffer, &bufferlen);
81
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_ERROR(result);
82
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 return String(buffer, bufferlen);
83 }
84
85 4 int64_t Time::toUnix() const
86 {
87 4 int64_t ret = 0;
88
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 result_t result = gate_time_to_unix(this->timestamp, &ret);
89
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
4 GATEXX_CHECK_ERROR(result);
90 4 return ret;
91 }
92
93 2 Time Time::add(int64_t microseconds) const
94 {
95 2 return Time(this->timestamp + microseconds, this->bias);
96 }
97 3 int64_t Time::diff(Time const& t) const
98 {
99 3 return this->timestamp - t.timestamp;
100 }
101 3 bool_t Time::empty() const
102 {
103 3 return this->timestamp == 0;
104 }
105
106 1 time::Microseconds Time::operator-(Time const& t) const
107 {
108 1 return time::Microseconds(this->diff(t));
109 }
110 1 bool Time::operator!() const
111 {
112 1 return this->empty();
113 }
114
115
116 2 Result<Time> Time::tryParse(String const& text)
117 {
118
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 Time tm;
119
1/2
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
2 result_t result = gate_time_parse_string(text.c_str(), text.size(), &tm);
120
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 return makeResult(result, tm);
121 }
122 1 Time Time::parse(String const& text)
123 {
124
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Result<Time> result = Time::tryParse(text);
125
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
1 if (result.hasError())
126 {
127 GATEXX_CHECK_EXCEPTION(result.error());
128 }
129 2 return result.value();
130 }
131 1 Time Time::fromUnix(int64_t unixSeconds)
132 {
133
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Time ret;
134
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 result_t result = gate_time_from_unix(unixSeconds, &ret.timestamp);
135
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_ERROR(result);
136 1 return ret;
137 }
138 3 Time Time::fromTimestamp(gate_timestamp_t source)
139 {
140
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 Time ret;
141
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 result_t result = gate_time_from_timestamp(source, &ret);
142
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
3 GATEXX_CHECK_ERROR(result);
143 3 return ret;
144 }
145
146 2 bool Time::operator==(gate_timestamp_t const& src) const { return this->timestamp == src; }
147 2 bool Time::operator!=(gate_timestamp_t const& src) const { return this->timestamp != src; }
148 1 bool Time::operator< (gate_timestamp_t const& src) const { return this->timestamp < src; }
149 2 bool Time::operator<=(gate_timestamp_t const& src) const { return this->timestamp <= src; }
150 1 bool Time::operator> (gate_timestamp_t const& src) const { return this->timestamp > src; }
151 2 bool Time::operator>=(gate_timestamp_t const& src) const { return this->timestamp >= src; }
152
153 2 bool Time::operator==(Time const& src) const { return *this == src.timestamp; }
154 2 bool Time::operator!=(Time const& src) const { return *this != src.timestamp; }
155 1 bool Time::operator< (Time const& src) const { return *this < src.timestamp; }
156 2 bool Time::operator<=(Time const& src) const { return *this <= src.timestamp; }
157 1 bool Time::operator> (Time const& src) const { return *this > src.timestamp; }
158 2 bool Time::operator>=(Time const& src) const { return *this >= src.timestamp; }
159
160
161
162 4 Date::Date(uint16_t years, uint8_t months, uint8_t days)
163 4 : gate_date_t()
164 {
165 4 this->year = years;
166 4 this->month = months;
167 4 this->day = days;
168 4 }
169 1 Date::Date(uint16_t years, MonthEnum months, uint8_t days)
170 1 : gate_date_t()
171 {
172 1 this->year = years;
173 1 this->month = (gate_uint8_t)months;
174 1 this->day = days;
175 1 }
176 19 Date::Date(gate_date_t const& date)
177 19 : gate_date_t(date)
178 {
179 19 }
180
181 14 int Date::compare(Date const& that) const
182 {
183
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
14 if (this->year < that.year) return -1;
184
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
14 if (this->year > that.year) return +1;
185
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
14 if (this->month < that.month) return -1;
186
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
14 if (this->month > that.month) return +1;
187
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 12 times.
14 if (this->day < that.day) return -1;
188
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 9 times.
12 if (this->day > that.day) return +1;
189 9 return 0;
190 }
191 1 bool_t Date::operator< (Date const& that) const
192 {
193 1 return this->compare(that) < 0;
194 }
195 1 bool_t Date::operator<=(Date const& that) const
196 {
197 1 return this->compare(that) <= 0;
198 }
199 1 bool_t Date::operator> (Date const& that) const
200 {
201 1 return this->compare(that) > 0;
202 }
203 1 bool_t Date::operator>=(Date const& that) const
204 {
205 1 return this->compare(that) >= 0;
206 }
207 1 bool_t Date::operator==(Date const& that) const
208 {
209 1 return (this->day == that.day)
210
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 && (this->month == that.month)
211
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 && (this->year == that.year);
212 }
213 1 bool_t Date::operator!=(Date const& that) const
214 {
215 1 return (this->year != that.year)
216
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 || (this->month != that.month)
217
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 || (this->day != that.day);
218 }
219
220
221
222 4 DayTime::DayTime(uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t microseconds)
223 {
224 4 gate_daytime_t& dt = *this;
225 4 gate_mem_clear(&dt, sizeof(dt));
226 4 dt.hour = hours;
227 4 dt.minute = minutes;
228 4 dt.second = seconds;
229 4 dt.microsecond = microseconds;
230 4 }
231
232 19 DayTime::DayTime(gate_daytime_t const& dtime)
233 {
234 19 gate_daytime_t& dt = *this;
235 19 gate_mem_clear(&dt, sizeof(dt));
236 19 dt.hour = dtime.hour;
237 19 dt.minute = dtime.minute;
238 19 dt.second = dtime.second;
239 19 dt.microsecond = dtime.microsecond;
240 19 }
241
242 14 int DayTime::compare(DayTime const& that) const
243 {
244
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 12 times.
14 if (this->hour < that.hour) return -1;
245
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 9 times.
12 if (this->hour > that.hour) return +1;
246
247
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
9 if (this->minute < that.minute) return -1;
248
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
9 if (this->minute > that.minute) return +1;
249
250
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
9 if (this->second < that.second) return -1;
251
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
9 if (this->second > that.second) return +1;
252
253
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 6 times.
9 if (this->microsecond < that.microsecond) return -1;
254
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 4 times.
6 if (this->microsecond > that.microsecond) return +1;
255
256 4 return 0;
257 }
258
259 1 bool_t DayTime::operator< (DayTime const& that) const
260 {
261 1 return this->compare(that) < 0;
262 }
263 1 bool_t DayTime::operator<=(DayTime const& that) const
264 {
265 1 return this->compare(that) <= 0;
266 }
267 1 bool_t DayTime::operator> (DayTime const& that) const
268 {
269 1 return this->compare(that) > 0;
270 }
271 1 bool_t DayTime::operator>=(DayTime const& that) const
272 {
273 1 return this->compare(that) >= 0;
274 }
275 2 bool_t DayTime::operator==(DayTime const& that) const
276 {
277 2 return (this->second == that.second)
278
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 && (this->minute == that.minute)
279
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
2 && (this->hour == that.hour)
280
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
4 && (this->microsecond == that.microsecond);
281 }
282 1 bool_t DayTime::operator!=(DayTime const& that) const
283 {
284 1 return !(*this == that);
285 }
286
287
288 7 DateTime::DateTime(uint16_t years, uint8_t months, uint8_t days, uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t microseconds)
289 7 : gate_datetime_t()
290 {
291 7 this->date.year = years;
292 7 this->date.month = months;
293 7 this->date.day = days;
294 7 this->time.hour = hours;
295 7 this->time.minute = minutes;
296 7 this->time.second = seconds;
297 7 this->time.microsecond = microseconds;
298 7 }
299 1 DateTime::DateTime(Date const& date, DayTime const& dt)
300 1 : gate_datetime_t()
301 {
302 1 this->date.year = date.year;
303 1 this->date.month = date.month;
304 1 this->date.day = date.day;
305 1 this->time.hour = dt.hour;
306 1 this->time.minute = dt.minute;
307 1 this->time.second = dt.second;
308 1 this->time.microsecond = dt.microsecond;
309 1 }
310 2 DateTime::DateTime(gate_time_t const& time)
311 2 : gate_datetime_t()
312 {
313 2 result_t result = gate_time_to_datetime(&time, this);
314
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 GATEXX_CHECK_ERROR(result);
315 2 }
316 6 DateTime::DateTime(gate_timestamp_t const& timestamp, bool addSystemBias)
317 6 : gate_datetime_t()
318 {
319 gate_time_t time;
320 6 time.timestamp = timestamp;
321 6 time.bias = 0;
322
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
6 if (addSystemBias && (timestamp != 0))
323 {
324 gate_time_t now;
325
2/4
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
6 if (GATE_SUCCEEDED(gate_time_now(&now)))
326 {
327 6 time.bias = now.bias;
328 }
329 }
330
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 result_t result = gate_time_to_datetime(&time, this);
331
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
6 GATEXX_CHECK_ERROR(result);
332 6 }
333
334 1 DateTime::DateTime(String const& text)
335 1 : gate_datetime_t()
336 {
337 gate_time_t tm;
338
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 result_t result = gate_time_parse_string(text.c_str(), text.length(), &tm);
339
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_ERROR(result);
340
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 result = gate_time_to_datetime(&tm, this);
341
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_ERROR(result);
342 1 }
343
344 2 bool_t DateTime::empty() const
345 {
346 2 return this->toTime().timestamp == 0;
347 }
348
349
350 19 Date DateTime::getDate() const
351 {
352 19 return Date(this->date);
353 }
354 19 DayTime DateTime::getDayTime() const
355 {
356 19 return DayTime(this->time);
357 }
358
359
360 1 DateTime DateTime::add(int64_t microseconds) const
361 {
362
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 return DateTime(this->toTime().add(microseconds));
363 }
364
365 2 int64_t DateTime::diff(DateTime const& dt) const
366 {
367
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 return this->toTime().diff(dt.toTime());
368 }
369
370 9 int DateTime::compare(DateTime const& that) const
371 {
372 9 int result = this->getDate().compare(that.getDate());
373
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
9 if (result != 0) return result;
374
1/2
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
9 return this->getDayTime().compare(that.getDayTime());
375 }
376
377
378 1 time::Microseconds DateTime::operator-(DateTime const& dt) const
379 {
380 1 return time::Microseconds(this->diff(dt));
381 }
382
383
384 13 Time DateTime::toTime() const
385 {
386
1/2
✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
13 Time ret;
387
1/2
✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
13 result_t result = gate_date_to_time(this, &ret);
388
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
13 GATEXX_CHECK_ERROR(result);
389 13 return ret;
390 }
391 2 String DateTime::toString(String const& format) const
392 {
393
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 Time tm = this->toTime();
394 char buffer[1024];
395 2 size_t buffersz = sizeof(buffer);
396
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
2 result_t result = gate_time_to_string(&tm, format.empty() ? NULL : format.c_str(), buffer, &buffersz);
397
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
2 GATEXX_CHECK_ERROR(result);
398
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 return String(buffer, buffersz);
399 }
400 1 bool DateTime::operator<(DateTime const& that) const { return this->compare(that) < 0; }
401 1 bool DateTime::operator<=(DateTime const& that) const { return this->compare(that) <= 0; }
402 1 bool DateTime::operator>(DateTime const& that) const { return this->compare(that) > 0; }
403 1 bool DateTime::operator>=(DateTime const& that) const { return this->compare(that) >= 0; }
404 4 bool DateTime::operator==(DateTime const& that) const { return this->compare(that) == 0; }
405 1 bool DateTime::operator!=(DateTime const& that) const { return this->compare(that) != 0; }
406
407
408
409 7 TimeCounter TimeCounter::now()
410 {
411 7 TimeCounter tc;
412
1/2
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
7 result_t result = gate_timecounter_now(&tc.tc);
413
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
7 GATEXX_CHECK_ERROR(result);
414 7 return tc;
415 }
416
417 8 TimeCounter::TimeCounter() noexcept
418 8 : tc(0)
419 {
420 8 }
421 3 TimeCounter::TimeCounter(gate_timecounter_t src) noexcept
422 3 : tc(src)
423 {
424 3 }
425 3 TimeCounter::TimeCounter(TimeCounter const& src) noexcept
426 3 : tc(src.tc)
427 {
428 3 }
429 1 TimeCounter& TimeCounter::operator=(TimeCounter const& src) noexcept
430 {
431 1 this->tc = src.tc;
432 1 return *this;
433 }
434 14 TimeCounter::~TimeCounter() noexcept
435 {
436 14 }
437
438 3 TimeCounter TimeCounter::add(int64_t microseconds) const noexcept
439 {
440 3 return TimeCounter(gate_timecounter_add(this->tc, microseconds));
441 }
442
443 18 int64_t TimeCounter::diff(gate_timecounter_t other) const noexcept
444 {
445 18 return gate_timecounter_diff(this->tc, other);
446 }
447 12 int64_t TimeCounter::diff(TimeCounter const& other) const noexcept
448 {
449 12 return this->diff(other.tc);
450 }
451
452 1 void TimeCounter::swap(TimeCounter& other) noexcept
453 {
454 1 gate_timecounter_t tmp = this->tc;
455 1 this->tc = other.tc;
456 1 other.tc = tmp;
457 1 }
458
459 2 bool_t TimeCounter::empty() const noexcept
460 {
461 2 return this->tc == 0;
462 }
463
464 7 gate_timecounter_t const* TimeCounter::c_impl() const noexcept
465 {
466 7 return &this->tc;
467 }
468
469 1 bool TimeCounter::operator!() const noexcept
470 {
471 1 return this->empty();
472 }
473
474
475 1 time::Microseconds TimeCounter::operator-(TimeCounter const& that) const noexcept
476 {
477 1 return time::Microseconds(this->diff(that));
478 }
479
480 1 bool TimeCounter::operator==(gate_timecounter_t that) const noexcept { return this->diff(that) == 0; };
481 2 bool TimeCounter::operator==(TimeCounter const& that) const noexcept { return this->diff(that) == 0; };
482
483 1 bool TimeCounter::operator!=(gate_timecounter_t that) const noexcept { return this->diff(that) != 0; };
484 1 bool TimeCounter::operator!=(TimeCounter const& that) const noexcept { return this->diff(that) != 0; };
485
486 1 bool TimeCounter::operator< (gate_timecounter_t that) const noexcept { return this->diff(that) < 0; };
487 3 bool TimeCounter::operator< (TimeCounter const& that) const noexcept { return this->diff(that) < 0; };
488
489 1 bool TimeCounter::operator> (gate_timecounter_t that) const noexcept { return this->diff(that) > 0; };
490 1 bool TimeCounter::operator> (TimeCounter const& that) const noexcept { return this->diff(that) > 0; };
491
492 1 bool TimeCounter::operator<=(gate_timecounter_t that) const noexcept { return this->diff(that) <= 0; };
493 1 bool TimeCounter::operator<=(TimeCounter const& that) const noexcept { return this->diff(that) <= 0; };
494
495 1 bool TimeCounter::operator>=(gate_timecounter_t that) const noexcept { return this->diff(that) >= 0; };
496 1 bool TimeCounter::operator>=(TimeCounter const& that) const noexcept { return this->diff(that) >= 0; };
497
498
499
500 } // end of namespace gate
501
502