TimerUtil provides utilities for time calculation. Using this class instead of Time variable directly provides better compatibility for further improvement.
More...
#include <E_TimeUtil.hpp>
|
enum | TimeUnit {
NSEC
, USEC
, MSEC
, SEC
,
MINUTE
, HOUR
, DAY
, NONE
} |
| Enumerations for time unit.
|
|
|
static enum TimeUnit | stringToTimeUnit (const std::string &unit) |
| Converts time unit string to TimeUnit enumeration. More...
|
|
static std::string | timeUnitToString (enum TimeUnit unit) |
| Converts TimeUnit enumeration to time unit string. More...
|
|
static Size | getMultiplier (enum TimeUnit unit) |
| Calculates multiplier for given time unit from the minimal TimeUnit. Current minimal TimeUnit is NSEC. For example, multiplier for millisecond is 1,000,000 and for microsecond is 1,000. More...
|
|
static Time | makeTime (Size time, enum TimeUnit unit) |
| Produces nanosecond time from a time in given time unit. More...
|
|
static Size | getTime (Time time, enum TimeUnit unit) |
| Converts nanosecond time value to a time in given time unit. More...
|
|
static std::string | printTime (Time time, enum TimeUnit unit) |
| Converts nanosecond time value to a time in given time unit in string. More...
|
|
TimerUtil provides utilities for time calculation. Using this class instead of Time variable directly provides better compatibility for further improvement.
- Note
- Current unit of Time is unsigned 64bit integer in nanoseconds. However, it may be extended to picosecond resolution or real number resolution. TimerUtil provides consistent view of Time.
◆ getMultiplier()
Size E::TimeUtil::getMultiplier |
( |
enum TimeUnit |
unit | ) |
|
|
static |
Calculates multiplier for given time unit from the minimal TimeUnit. Current minimal TimeUnit is NSEC. For example, multiplier for millisecond is 1,000,000 and for microsecond is 1,000.
- Parameters
-
- Returns
- Multiplier for given TimeUtil::TimeUnit enumeration
◆ getTime()
Size E::TimeUtil::getTime |
( |
Time |
time, |
|
|
enum TimeUnit |
unit |
|
) |
| |
|
static |
Converts nanosecond time value to a time in given time unit.
- Parameters
-
- Returns
- Time value in given time unit
◆ makeTime()
Time E::TimeUtil::makeTime |
( |
Size |
time, |
|
|
enum TimeUnit |
unit |
|
) |
| |
|
static |
Produces nanosecond time from a time in given time unit.
- Parameters
-
- Returns
- Time value (currently, in nanosecond)
◆ printTime()
std::string E::TimeUtil::printTime |
( |
Time |
time, |
|
|
enum TimeUnit |
unit |
|
) |
| |
|
static |
Converts nanosecond time value to a time in given time unit in string.
- Parameters
-
- Returns
- Time string in given time unit
◆ stringToTimeUnit()
Converts time unit string to TimeUnit enumeration.
- Parameters
-
unit | Time unit string (e.g. "NSEC", "USEC", etc.) |
- Returns
- TimeUtil::TimeUnit enumeration for given time unit string
◆ timeUnitToString()
std::string E::TimeUtil::timeUnitToString |
( |
enum TimeUnit |
unit | ) |
|
|
static |
Converts TimeUnit enumeration to time unit string.
- Parameters
-
- Returns
- Time unit string for given TimeUnit enumeration
The documentation for this class was generated from the following files: