|
SatCat5
|
Timestamp for measuring elapsed time.
SatCat5 system timer concepts.
Timestamp value returned by TimeRef::now() and other methods. Represents a moment in time, either now or in the near future.
#include <timeref.h>
Public Member Functions | |
| TimeVal (const TimeVal &t)=default | |
| TimeVal & | operator= (const TimeVal &t)=default |
| unsigned | elapsed_tick () const |
| Measure elapsed time in ticks. More... | |
| unsigned | elapsed_usec () const |
| Elapsed time in microseconds. More... | |
| unsigned | elapsed_msec () const |
| Elapsed time in milliseconds. More... | |
| unsigned | increment_usec () |
| Measure elapsed time in microseconds, then increment by the returned quantized value. More... | |
| unsigned | increment_msec () |
| Measure elapsed time in milliseconds, then increment by the returned quantized value. More... | |
| bool | interval_tick (u32 ticks) |
| Test an interval measured in ticks. More... | |
| bool | interval_usec (unsigned usec) |
| Test an interval measured in microseconds. More... | |
| bool | interval_msec (unsigned msec) |
| Test an interval measured in milliseconds. More... | |
| bool | checkpoint_elapsed () |
| Test if an oven-timer checkpoint has elapsed. More... | |
Public Attributes | |
| TimeRef * | clk |
| Pointer to the parent time reference. | |
| u32 | tval |
| The value of this timestamp, measured in ticks. | |
| bool TimeVal::checkpoint_elapsed | ( | ) |
Test if an oven-timer checkpoint has elapsed.
If so, disable it (set to zero) and return true.
To create a checkpoint, use methods TimeRef::checkpoint_usec() or TimeRef::checkpoint_msec().
This example polls an object until a timeout has elapsed:
Definition at line 77 of file timeref.cc.
| unsigned TimeVal::elapsed_msec | ( | ) | const |
| unsigned TimeVal::elapsed_tick | ( | ) | const |
Measure elapsed time in ticks.
This example measures time spent in the "do_thing()" function:
Definition at line 19 of file timeref.cc.
| unsigned TimeVal::elapsed_usec | ( | ) | const |
| unsigned TimeVal::increment_msec | ( | ) |
Measure elapsed time in milliseconds, then increment by the returned quantized value.
Measure elapsed time since the timestamp, then increment the timestamp by that integer quantity. This is typically used to avoid cumulative rounding error for recurring events.
This example measures time spent in the "do_thing()" function:
Definition at line 39 of file timeref.cc.
| unsigned TimeVal::increment_usec | ( | ) |
Measure elapsed time in microseconds, then increment by the returned quantized value.
Measure elapsed time since the timestamp, then increment the timestamp by that integer quantity. This is typically used to avoid cumulative rounding error for recurring events.
This example measures time spent in the "do_thing()" function:
Definition at line 33 of file timeref.cc.
| bool TimeVal::interval_msec | ( | unsigned | msec | ) |
Test an interval measured in milliseconds.
Measure elapsed time since the timestamp. If that exceeds the designated interval, then return true and increment the timestamp by the designated amount. Otherwise, return false. This is typically used to measure repeating events.
This example prints a message once every second:
Definition at line 60 of file timeref.cc.
| bool TimeVal::interval_tick | ( | u32 | ticks | ) |
Test an interval measured in ticks.
Measure elapsed time since the timestamp. If that exceeds the designated interval, then return true and increment the timestamp by the designated amount. Otherwise, return false. This is typically used to measure repeating events.
This example prints a message once every second:
Definition at line 45 of file timeref.cc.
| bool TimeVal::interval_usec | ( | unsigned | usec | ) |
Test an interval measured in microseconds.
Measure elapsed time since the timestamp. If that exceeds the designated interval, then return true and increment the timestamp by the designated amount. Otherwise, return false. This is typically used to measure repeating events.
This example prints a message once every second:
Definition at line 55 of file timeref.cc.