#include <evo/timer.h>
Holds a CPU (process) timer-stamp, used as template argument with TimerT.
|
static void | get_wall_datetime_fields_local (int &year, int &month, int &day, int &hour, int &minute, int &second, int &msecond) |
| Get fields for current real (wall clock) time for calendar date/time use (Local Time). More...
|
|
static void | get_wall_datetime_fields_local (int &year, int &month, int &day, int &hour, int &minute, int &second, int &msecond, int &tz_offset) |
| Get fields for current real (wall clock) time for calendar date/time use (Local Time). More...
|
|
static void | get_wall_datetime_fields_utc (int &year, int &month, int &day, int &hour, int &minute, int &second, int &msecond) |
| Get fields for current real (wall clock) time for calendar date/time use (UTC). More...
|
|
static int | tz_get_offset () |
| Get current time zone (local time) offset from UTC in minutes. More...
|
|
static void | tz_init () |
| Initializater that optimizes timezone (local time) conversion in some cases. More...
|
|
|
ulong | nsec |
| Number of nanoseconds from seconds. More...
|
|
ulongl | sec |
| Number of seconds since Jan 1, EPOCH_YEAR. More...
|
|
◆ add_msec()
void add_msec |
( |
ulong |
new_msec | ) |
|
|
inlineinherited |
Add milliseconds to current time.
- This normalizes the current time so the
nsec
field has less than 1 second
- Parameters
-
new_msec | Milliseconds to add |
◆ add_nsec()
void add_nsec |
( |
ulongl |
new_nsec | ) |
|
|
inlineinherited |
Add nanoseconds to current time.
- This normalizes the current time so the
nsec
field has less than 1 second
- Parameters
-
new_nsec | Nanoseconds to add |
◆ clear()
◆ compare()
Compare to another timestamp.
- Parameters
-
oth | Other timestamp to compare to |
- Returns
- Result (<0 if this is less, 0 if equal, >0 if this is greater)
◆ diff_msec()
Use this as an end-time and get the difference from start time in milliseconds.
- Parameters
-
start | Start time to use, must not be greater than this |
- Returns
- Difference in milliseconds
◆ diff_nsec()
Use this as an end-time and get the difference from start time in nanoseconds.
- Parameters
-
start | Start time to use, must not be greater than this |
- Returns
- Difference in nanoseconds
◆ diff_usec()
Use this as an end-time and get the difference from start time in microseconds.
- Parameters
-
start | Start time to use, must not be greater than this |
- Returns
- Difference in microseconds
◆ get_wall_datetime_fields_local() [1/2]
static void get_wall_datetime_fields_local |
( |
int & |
year, |
|
|
int & |
month, |
|
|
int & |
day, |
|
|
int & |
hour, |
|
|
int & |
minute, |
|
|
int & |
second, |
|
|
int & |
msecond |
|
) |
| |
|
inlinestaticinherited |
Get fields for current real (wall clock) time for calendar date/time use (Local Time).
- This is equivalent of using get_wall_datetime() then converting the timestamp to date/time fields in local time
- Time is in the current local timezone, but this does not get the local timezone offset
- Parameters
-
year | Set to 4 digit year for date [out] |
month | Set to month of year for date (1 - 12) [out] |
day | Set to day of moneth for date (1 - 31) [out] |
hour | Set to hour for time of day (0 - 23) [out] |
minute | Minutes for time of day (0 - 59) [out] |
second | Seconds for time of day (0 - 60) [out] |
msecond | Milliseconds for time of day (0 - 999) [out] |
◆ get_wall_datetime_fields_local() [2/2]
static void get_wall_datetime_fields_local |
( |
int & |
year, |
|
|
int & |
month, |
|
|
int & |
day, |
|
|
int & |
hour, |
|
|
int & |
minute, |
|
|
int & |
second, |
|
|
int & |
msecond, |
|
|
int & |
tz_offset |
|
) |
| |
|
inlinestaticinherited |
Get fields for current real (wall clock) time for calendar date/time use (Local Time).
- This is equivalent of using get_wall_datetime() then converting the timestamp to date/time fields in local time
- Time is in the current local timezone
- Parameters
-
year | Set to 4 digit year for date [out] |
month | Set to month of year for date (1 - 12) [out] |
day | Set to day of moneth for date (1 - 31) [out] |
hour | Set to hour for time of day (0 - 23) [out] |
minute | Minutes for time of day (0 - 59) [out] |
second | Seconds for time of day (0 - 60) [out] |
msecond | Milliseconds for time of day (0 - 999) [out] |
tz_offset | Time zone offset in minutes, see tz_get_offset() [out] |
◆ get_wall_datetime_fields_utc()
static void get_wall_datetime_fields_utc |
( |
int & |
year, |
|
|
int & |
month, |
|
|
int & |
day, |
|
|
int & |
hour, |
|
|
int & |
minute, |
|
|
int & |
second, |
|
|
int & |
msecond |
|
) |
| |
|
inlinestaticinherited |
Get fields for current real (wall clock) time for calendar date/time use (UTC).
- This is equivalent of using get_wall_datetime() then converting the timestamp to date/time fields
- Timezone is always UTC here
- Parameters
-
year | Set to 4 digit year for date [out] |
month | Set to month of year for date (1 - 12) [out] |
day | Set to day of moneth for date (1 - 31) [out] |
hour | Set to hour for time of day (0 - 23) [out] |
minute | Minutes for time of day (0 - 59) [out] |
second | Seconds for time of day (0 - 60) [out] |
msecond | Milliseconds for time of day (0 - 999) [out] |
◆ set() [1/2]
◆ set() [2/2]
Set from system native timestamp.
- This converts from SysNativeTimeStamp, which has platform-specific fields
- Timezone is always UTC here
- Parameters
-
src | Source to convert from |
◆ set_cpu()
Set as current CPU (process) time for use by timers.
◆ tz_get_offset()
static int tz_get_offset |
( |
| ) |
|
|
inlinestaticinherited |
Get current time zone (local time) offset from UTC in minutes.
- Returns
- Time zone offset from UTC in minutes, 0 for UTC, negative for the Western Hemisphere (America), positive for the remaining time zones
◆ tz_init()
Initializater that optimizes timezone (local time) conversion in some cases.
- On some systems (Linux) this sets an env var (
TZ
) if not already set, which reduces system calls for local time conversion
- Caution: Not thread safe – this should be called once at startup, before other threads are started
◆ EPOCH_YEAR
const int EPOCH_YEAR = 1970 |
|
staticinherited |
Epoch year used by system – 1970 for Linux/Unix/POSIX, 1601 for Windows.
◆ MSEC_PER_SEC
const ulong MSEC_PER_SEC = 1000 |
|
staticinherited |
◆ nsec
Number of nanoseconds from seconds.
◆ NSEC_PER_MSEC
const ulong NSEC_PER_MSEC = 1000000UL |
|
staticinherited |
Nanoseconds per millisecond.
◆ NSEC_PER_SEC
const ulong NSEC_PER_SEC = 1000000000UL |
|
staticinherited |
◆ NSEC_PER_USEC
const ulong NSEC_PER_USEC = 1000 |
|
staticinherited |
Nanoseconds per microsecond.
◆ sec
Number of seconds since Jan 1, EPOCH_YEAR.
◆ SEC_PER_MIN
const int SEC_PER_MIN = 60 |
|
staticinherited |
◆ USEC_PER_SEC
const ulong USEC_PER_SEC = 1000000UL |
|
staticinherited |
The documentation for this class was generated from the following file: