NanoTime::TimeSource< Clock_, unit_, TimeType_ > Struct Template Reference

Class template for accessing a Clock in specific time units. More...

#include <NanoTime.h>

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< timetimeConst ()
 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_ >
static constexpr Ticks<Clock_, TimeType_> NanoTime::TimeSource< Clock_, unit_, TimeType_ >::maxCalcTicks ( )
inlinestaticconstexpr

The maximum tick value supported by ticksToTime without overflowing.

Return values
TimeTypePassing values larger than this to ticksToTime() will truncate at maximum value

◆ maxCalcTime()

template<class Clock_ , Unit unit_, typename TimeType_ >
static constexpr Time<TimeType_> NanoTime::TimeSource< Clock_, unit_, TimeType_ >::maxCalcTime ( )
inlinestaticconstexpr

The maximum time value supported by timeToTicks without overflowing.

Return values
TimeTypePassing values larger than this to timeToTicks() will truncate at maximum value

◆ maxClockTime()

template<class Clock_ , Unit unit_, typename TimeType_ >
static constexpr MaxClockTime NanoTime::TimeSource< Clock_, unit_, TimeType_ >::maxClockTime ( )
inlinestaticconstexpr

◆ ticksConst()

template<class Clock_ , Unit unit_, typename TimeType_ >
template<uint64_t ticks>
static constexpr TicksConst<ticks> NanoTime::TimeSource< Clock_, unit_, TimeType_ >::ticksConst ( )
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_ >
static constexpr BasicRatio32 NanoTime::TimeSource< Clock_, unit_, TimeType_ >::ticksPerUnit ( )
inlinestaticconstexpr

Number of clock ticks per unit of time.

Return values
BasicRatio32Result as a rational fraction

◆ ticksToTime() [1/2]

template<class Clock_ , Unit unit_, typename TimeType_ >
template<uint64_t ticks>
static constexpr uint64_t NanoTime::TimeSource< Clock_, unit_, TimeType_ >::ticksToTime ( )
inlinestaticconstexpr

Get the time for a given number of clock ticks.

Template Parameters
ticks
Return values
TimeTypeTime count, rounded to the nearest unit

◆ ticksToTime() [2/2]

template<class Clock_ , Unit unit_, typename TimeType_ >
static Time<TimeType_> NanoTime::TimeSource< Clock_, unit_, TimeType_ >::ticksToTime ( TimeType  ticks)
inlinestatic

Get the time for a given number of clock ticks.

Parameters
ticks
Return values
TimeTypeTime count, rounded to the nearest unit

◆ timeConst()

template<class Clock_ , Unit unit_, typename TimeType_ >
template<uint64_t time>
static constexpr TimeConst<time> NanoTime::TimeSource< Clock_, unit_, TimeType_ >::timeConst ( )
inlinestaticconstexpr

Obtain a TimeConst type representing the given time quantity.

Template Parameters
time
Return values
TimeConst
Note
Use methods of TimeConst to obtain corresponding tick count, etc.

◆ timeToTicks() [1/2]

template<class Clock_ , Unit unit_, typename TimeType_ >
template<uint64_t time>
static constexpr uint64_t NanoTime::TimeSource< Clock_, unit_, TimeType_ >::timeToTicks ( )
inlinestaticconstexpr

Get the number of ticks for a given time.

Template Parameters
time
Return values
uint64_tTick count, rounded to the nearest tick

◆ timeToTicks() [2/2]

template<class Clock_ , Unit unit_, typename TimeType_ >
static Ticks<Clock_, TimeType_> NanoTime::TimeSource< Clock_, unit_, TimeType_ >::timeToTicks ( TimeType  time)
inlinestatic

Get the number of ticks for a given time.

Parameters
time
Return values
TimeTypeTick count, rounded to the nearest tick

◆ toString()

template<class Clock_ , Unit unit_, typename TimeType_ >
static String NanoTime::TimeSource< Clock_, unit_, TimeType_ >::toString ( )
inlinestatic

◆ unit()

template<class Clock_ , Unit unit_, typename TimeType_ >
static constexpr Unit NanoTime::TimeSource< Clock_, unit_, TimeType_ >::unit ( )
inlinestaticconstexpr

The documentation for this struct was generated from the following file: