NanoTime::TimeSource< Clock_, unit_, TimeType_ > Struct Template Reference
Class template for accessing a Clock in specific time units. More...
#include <NanoTime.h>
Inheritance diagram for NanoTime::TimeSource< Clock_, unit_, TimeType_ >:
Collaboration diagram for NanoTime::TimeSource< Clock_, unit_, TimeType_ >:
Public Types | |
using | Clock = Clock_ |
using | TimeType = TimeType_ |
using | TicksPerUnit = typename Clock::template TicksPerUnit< unit_ > |
template<uint64_t time> | |
using | TimeConst = TimeConst< Clock, unit_, time > |
template<uint64_t ticks> | |
using | TicksConst = TicksConst< Clock, ticks > |
using | MaxClockTime = typename Clock::template MaxTime< unit_ > |
Get the time corresponding to the maximum clock tick value. More... | |
Static Public Member Functions | |
static constexpr Unit | unit () |
static constexpr BasicRatio32 | ticksPerUnit () |
Number of clock ticks per unit of time. More... | |
static constexpr MaxClockTime | maxClockTime () |
template<uint64_t time> | |
static constexpr TimeConst< time > | timeConst () |
Obtain a TimeConst type representing the given time quantity. More... | |
template<uint64_t ticks> | |
static constexpr TicksConst< ticks > | ticksConst () |
Class template defining a fixed tick quantity. More... | |
static constexpr Time< TimeType_ > | maxCalcTime () |
The maximum time value supported by timeToTicks without overflowing. More... | |
static constexpr Ticks< Clock_, TimeType_ > | maxCalcTicks () |
The maximum tick value supported by ticksToTime without overflowing. More... | |
static Ticks< Clock_, TimeType_ > | timeToTicks (TimeType time) |
Get the number of ticks for a given time. More... | |
template<uint64_t time> | |
static constexpr uint64_t | timeToTicks () |
Get the number of ticks for a given time. More... | |
template<uint64_t ticks> | |
static constexpr uint64_t | ticksToTime () |
Get the time for a given number of clock ticks. More... | |
static Time< TimeType_ > | ticksToTime (TimeType ticks) |
Get the time for a given number of clock ticks. More... | |
static String | toString () |
Detailed Description
template<class Clock_, Unit unit_, typename TimeType_>
struct NanoTime::TimeSource< Clock_, unit_, TimeType_ >
Class template for accessing a Clock in specific time units.
- Template Parameters
-
Clock_ units_ TimeType_ Limits range of calculations
- Note
- Includes compile-time range checking. Time is taken as reference for conversions.
Member Typedef Documentation
◆ Clock
template<class Clock_ , Unit unit_, typename TimeType_ >
using NanoTime::TimeSource< Clock_, unit_, TimeType_ >::Clock = Clock_ |
◆ MaxClockTime
template<class Clock_ , Unit unit_, typename TimeType_ >
using NanoTime::TimeSource< Clock_, unit_, TimeType_ >::MaxClockTime = typename Clock::template MaxTime<unit_> |
Get the time corresponding to the maximum clock tick value.
◆ TicksConst
template<class Clock_ , Unit unit_, typename TimeType_ >
template<uint64_t ticks>
using NanoTime::TimeSource< Clock_, unit_, TimeType_ >::TicksConst = TicksConst<Clock, ticks> |
◆ TicksPerUnit
template<class Clock_ , Unit unit_, typename TimeType_ >
using NanoTime::TimeSource< Clock_, unit_, TimeType_ >::TicksPerUnit = typename Clock::template TicksPerUnit<unit_> |
◆ TimeConst
template<class Clock_ , Unit unit_, typename TimeType_ >
template<uint64_t time>
using NanoTime::TimeSource< Clock_, unit_, TimeType_ >::TimeConst = TimeConst<Clock, unit_, time> |
◆ TimeType
template<class Clock_ , Unit unit_, typename TimeType_ >
using NanoTime::TimeSource< Clock_, unit_, TimeType_ >::TimeType = TimeType_ |
Member Function Documentation
◆ maxCalcTicks()
template<class Clock_ , Unit unit_, typename TimeType_ >
|
inlinestaticconstexpr |
The maximum tick value supported by ticksToTime without overflowing.
- Return values
-
TimeType Passing values larger than this to ticksToTime()
will truncate at maximum value
◆ maxCalcTime()
template<class Clock_ , Unit unit_, typename TimeType_ >
|
inlinestaticconstexpr |
The maximum time value supported by timeToTicks without overflowing.
- Return values
-
TimeType Passing values larger than this to timeToTicks()
will truncate at maximum value
◆ maxClockTime()
template<class Clock_ , Unit unit_, typename TimeType_ >
|
inlinestaticconstexpr |
◆ ticksConst()
template<class Clock_ , Unit unit_, typename TimeType_ >
template<uint64_t ticks>
|
inlinestaticconstexpr |
Class template defining a fixed tick quantity.
- Template Parameters
-
ticks
- Return values
-
TicksConst
- Note
- Use methods of TickConst to obtain corresponding time values, etc.
◆ ticksPerUnit()
template<class Clock_ , Unit unit_, typename TimeType_ >
|
inlinestaticconstexpr |
Number of clock ticks per unit of time.
- Return values
-
BasicRatio32 Result as a rational fraction
◆ ticksToTime() [1/2]
template<class Clock_ , Unit unit_, typename TimeType_ >
template<uint64_t ticks>
|
inlinestaticconstexpr |
Get the time for a given number of clock ticks.
- Template Parameters
-
ticks
- Return values
-
TimeType Time count, rounded to the nearest unit
◆ ticksToTime() [2/2]
template<class Clock_ , Unit unit_, typename TimeType_ >
|
inlinestatic |
Get the time for a given number of clock ticks.
- Parameters
-
ticks
- Return values
-
TimeType Time count, rounded to the nearest unit
◆ timeConst()
template<class Clock_ , Unit unit_, typename TimeType_ >
template<uint64_t time>
|
inlinestaticconstexpr |
◆ timeToTicks() [1/2]
template<class Clock_ , Unit unit_, typename TimeType_ >
template<uint64_t time>
|
inlinestaticconstexpr |
Get the number of ticks for a given time.
- Template Parameters
-
time
- Return values
-
uint64_t Tick count, rounded to the nearest tick
◆ timeToTicks() [2/2]
template<class Clock_ , Unit unit_, typename TimeType_ >
|
inlinestatic |
Get the number of ticks for a given time.
- Parameters
-
time
- Return values
-
TimeType Tick count, rounded to the nearest tick
◆ toString()
template<class Clock_ , Unit unit_, typename TimeType_ >
|
inlinestatic |
◆ unit()
template<class Clock_ , Unit unit_, typename TimeType_ >
|
inlinestaticconstexpr |
The documentation for this struct was generated from the following file: