NanoTime.h File Reference
#include <cstdint>
#include <esp_attr.h>
#include <sming_attr.h>
#include <cmath>
#include "Rational.h"
#include <WString.h>
Include dependency graph for NanoTime.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  NanoTime::Frequency
 Class to represent a frequency. More...
 
struct  NanoTime::Clock< ClockDef, frequency_, TickType_, maxTicks_ >
 Class template representing a physical Clock with fixed timing characteristics. More...
 
struct  NanoTime::TimeValue
 A time time broken into its constituent elements. More...
 
struct  NanoTime::Time< T >
 Class to handle a simple time value with associated unit. More...
 
struct  NanoTime::Ticks< Clock_, T >
 Class to handle a tick value associated with a clock. More...
 
struct  NanoTime::TimeConst< Clock_, unit_, time_ >
 Class template to represent a fixed time value for a specific Clock. More...
 
struct  NanoTime::TicksConst< Clock_, ticks_ >
 Class template representing a fixed clock tick count. More...
 
struct  NanoTime::TimeSource< Clock_, unit_, TimeType_ >
 Class template for accessing a Clock in specific time units. More...
 

Namespaces

 NanoTime
 

Typedefs

template<Unit unit>
using NanoTime::UnitTickRatio = std::ratio< unitTicks[unit].num, unitTicks[unit].den >
 Class template to define tick std::ratio type. More...
 

Enumerations

enum  NanoTime::Unit {
  NanoTime::Nanoseconds , NanoTime::Microseconds , NanoTime::Milliseconds , NanoTime::Seconds ,
  NanoTime::Minutes , NanoTime::Hours , NanoTime::Days , NanoTime::UnitMax = Days
}
 Identify units for a scalar quantity of time. More...
 

Functions

const char * NanoTime::unitToString (Unit unit)
 Get a string identifying the given time units, e.g. "ns". More...
 
const char * NanoTime::unitToLongString (Unit unit)
 Get a long string identifying the given time units, e.g. "seconds". More...
 
template<uint64_t time, Unit unitsFrom, Unit unitsTo, typename R = std::ratio_divide<UnitTickRatio<unitsTo>, UnitTickRatio<unitsFrom>>>
constexpr uint64_t NanoTime::convert ()
 Function template to convert a constant time quantity from one unit to another. More...
 
template<typename TimeType >
TimeType NanoTime::convert (const TimeType &time, Unit unitsFrom, Unit unitsTo)
 Function template to convert a time quantity from one unit to another. More...
 
template<typename T >
Time< T > NanoTime::time (Unit unit, T value)
 Helper function to create a Time and deduce the type. More...
 
template<Unit unitsFrom, Unit unitsTo, typename TimeType >
TimeType NanoTime::convert (const TimeType &time)
 Function template to convert a time quantity from one unit to another. More...
 

Variables

constexpr BasicRatio32 NanoTime::unitTicks [UnitMax+1]
 List of clock ticks for each supported unit of time. More...