Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
TimeValue Class Reference

#include "lib/time/timevalue.hpp"

Description

basic constant internal time value.

These time values provide the implementation base for all further time types. They can be created by wrapping up a raw micro tick value (raw_time_64), are totally ordered, but besides that, they are opaque and non-mutable.

Note
clients should prefer to use Time instances, which explicitly denote an Lumiera internal time value and are easier to use.
See also
TimeVar when full arithmetics are required

Definition at line 142 of file timevalue.hpp.

Static Public Attributes

static const raw_time_64 SCALE = 1'000'000
 Number of micro ticks (µs) per second as basic time scale.
 

Static Public Member Functions

static TimeValue buildRaw_ (raw_time_64)
 

Public Member Functions

 TimeValue (raw_time_64 val)
 
 TimeValue (TimeValue const &o)
 copy initialisation allowed
 
 operator std::string () const
 
bool isRegular () const
 
std::strong_ordering operator<=> (TimeValue const &) const =default
 
bool operator== (TimeValue const &) const =default
 
std::strong_ordering operator<=> (raw_time_64 tt) const
 
bool operator== (raw_time_64 tt) const
 

Friends

class Mutation
 some subclasses may receive modification messages
 
raw_time_64 _raw (TimeValue const &time)
 
HashVal hash_value (TimeValue const &)
 derive a hash from the µ-tick value
 

Protected Member Functions

TimeValueoperator= (TimeValue const &o)
 Assigning of time values is not allowed, but derived classed might allow that.
 
 TimeValue (TimeValue const &origin, TimeValue const &target)
 

Static Protected Member Functions

static raw_time_64 limitedTime (raw_time_64 raw)
 explicit limit of allowed time range
 
static raw_time_64 limitedDelta (raw_time_64 origin, raw_time_64 target)
 safe calculation of explicitly limited time offset
 

Protected Attributes

raw_time_64 t_
 the raw (internal) time value used to implement the time types
 

Constructor & Destructor Documentation

◆ TimeValue() [1/3]

TimeValue ( TimeValue const &  origin,
TimeValue const &  target 
)
inlineprotected

for Offset and Duration entities built on top

Definition at line 168 of file timevalue.hpp.

◆ TimeValue() [2/3]

TimeValue ( raw_time_64  val)
inlineexplicit
Parameters
valtime given in µ ticks here

Definition at line 178 of file timevalue.hpp.

◆ TimeValue() [3/3]

TimeValue ( TimeValue const &  o)
inline

copy initialisation allowed

Definition at line 183 of file timevalue.hpp.

Member Function Documentation

◆ operator=()

TimeValue & operator= ( TimeValue const &  o)
inlineprotected

Assigning of time values is not allowed, but derived classed might allow that.

Definition at line 153 of file timevalue.hpp.

References TimeValue::t_.

Referenced by Offset::operator=().

+ Here is the caller graph for this function:

◆ limitedTime()

raw_time_64 limitedTime ( raw_time_64  raw)
inlinestaticprotected

explicit limit of allowed time range

applies a limiter on the provided raw time value to keep it within the arbitrary boundaries defined by (Time::MAX, Time::MIN). While Time entities are not a "safeInt" implementation, we limit new values to lower the likelihood of wrap-around

Definition at line 760 of file timevalue.hpp.

References Time::MAX.

◆ limitedDelta()

raw_time_64 limitedDelta ( raw_time_64  origin,
raw_time_64  target 
)
inlinestaticprotected

safe calculation of explicitly limited time offset

Definition at line 766 of file timevalue.hpp.

References Duration::MAX.

◆ buildRaw_()

TimeValue buildRaw_ ( raw_time_64  raw)
static

backdoor to sneak in a raw time value bypassing any normalisation and limiting

Definition at line 268 of file time.cpp.

Referenced by RealClock::_readSystemTime(), Offset::stretchedByFloatFactor(), and Offset::stretchedByRationalFactor().

+ Here is the caller graph for this function:

◆ operator std::string()

operator std::string ( ) const
explicit

diagnostics

◆ isRegular()

bool isRegular ( ) const
inline
Returns
is in-domain, not a boundary value

Definition at line 787 of file timevalue.hpp.

References Time::MAX, and Time::MIN.

Referenced by LoadController::markLagSample(), ActivationEvent::refineTo(), LoadController::tendedNext(), and ActivityDetector::wasInvoked().

+ Here is the caller graph for this function:

◆ operator<=>() [1/2]

std::strong_ordering operator<=> ( TimeValue const &  ) const
default

◆ operator==() [1/2]

bool operator== ( TimeValue const &  ) const
default

◆ operator<=>() [2/2]

std::strong_ordering operator<=> ( raw_time_64  tt) const
inline

Definition at line 202 of file timevalue.hpp.

◆ operator==() [2/2]

bool operator== ( raw_time_64  tt) const
inline

Definition at line 203 of file timevalue.hpp.

References TimeValue::t_.

Member Data Documentation

◆ t_

◆ SCALE

Friends And Related Symbol Documentation

◆ Mutation

friend class Mutation
friend

some subclasses may receive modification messages

Definition at line 160 of file timevalue.hpp.

◆ _raw

raw_time_64 _raw ( TimeValue const &  time)
friend

to pass Time values to C functions

Definition at line 188 of file timevalue.hpp.

Referenced by TimeSpan::conform().

◆ hash_value

HashVal hash_value ( TimeValue const &  time)
friend

derive a hash from the µ-tick value

Returns
rotation of the raw value to produce a suitable spacing for consecutive time
Remarks
picked up by Boost-hash, or std. hashtables with the help of hash-standard.h
See also
https://stackoverflow.com/questions/31387778/near-constant-time-rotate-that-does-not-violate-the-standards/31488147#31488147

Definition at line 741 of file timevalue.hpp.

+ Inheritance diagram for TimeValue:
+ Collaboration diagram for TimeValue:

The documentation for this class was generated from the following files: