MIRA
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Time< AsString > Class Template Reference

Derivation of mira::Time with human-readable serialization. More...

#include <utils/TimeHumanReadable.h>

Inheritance diagram for Time< AsString >:
Inheritance graph
[legend]

Public Types

typedef mira::Time Base
 

Public Member Functions

 Time ()
 
 Time (const Base &date)
 
template<typename Reflector >
MIRA_SPLIT_REFLECT_MEMBER void reflectRead (Reflector &r)
 
template<typename Reflector >
void reflectWrite (Reflector &r)
 
void reflect (PropertySerializer &r)
 
uint32 toUnixTimestamp () const
 Converts the current time to a unix timestamp in seconds. More...
 
uint64 toUnixNS () const
 Converts the current time to a unix timestamp in nanoseconds. More...
 
Time toLocal () const
 Converts to local time zone based on the settings of the machine. More...
 
Time toTimeZone (const std::string &zone)
 Converts to given time zone. More...
 
bool isValid () const
 Returns true if this contains a valid time. More...
 
Operators
Duration operator- (const Time &t) const
 
Time operator- (const DateDuration &d) const
 
Time operator- (const Duration &d) const
 
Time operator+ (const DateDuration &d) const
 
Time operator+ (const Duration &d) const
 
Time operator+= (const DateDuration &d)
 
Time operator+= (const Duration &d)
 
Time operator-= (const DateDuration &d)
 
Time operator-= (const Duration &d)
 

Static Public Member Functions

static Time now ()
 Returns the current utc based time. More...
 
static Time eternity ()
 Returns 9999/12/31 23:59:59.999999. More...
 
static Time invalid ()
 Returns an invalid time. More...
 
static Time unixEpoch ()
 Returns the unix epoch 1.1.1970 0:0:0.000. More...
 
static Time fromUnixTimestamp (uint32 seconds)
 Creates a time representation out of a unix timestamp. More...
 
static Time fromUnixNS (uint64 nanoseconds)
 Creates a time representation out of a unix timestamp. More...
 

Detailed Description

template<bool AsString = true>
class mira::HumanReadableSerialization::Time< AsString >

Derivation of mira::Time with human-readable serialization.

Specialized as TimeSerializedAsIsoString, TimeSerializedAsYMDHMS

Member Typedef Documentation

◆ Base

typedef mira::Time Base

Constructor & Destructor Documentation

◆ Time() [1/2]

Time ( )
inline

◆ Time() [2/2]

Time ( const Base date)
inline

Member Function Documentation

◆ reflectRead()

MIRA_SPLIT_REFLECT_MEMBER void reflectRead ( Reflector &  r)
inline

◆ reflectWrite()

void reflectWrite ( Reflector &  r)
inline

◆ reflect()

void reflect ( PropertySerializer r)
inline

◆ now()

static Time now ( )
inlinestaticinherited

Returns the current utc based time.

Returns
The current time.
Examples:
tutorials/Point2Visualization.C, and tutorials/Point3Visualization.C.

◆ eternity()

static Time eternity ( )
inlinestaticinherited

Returns 9999/12/31 23:59:59.999999.

◆ invalid()

static Time invalid ( )
inlinestaticinherited

Returns an invalid time.

◆ unixEpoch()

static Time unixEpoch ( )
inlinestaticinherited

Returns the unix epoch 1.1.1970 0:0:0.000.

Returns
Unix epoch time.

◆ toUnixTimestamp()

uint32 toUnixTimestamp ( ) const
inlineinherited

Converts the current time to a unix timestamp in seconds.

Returns
timestamp in seconds.

◆ fromUnixTimestamp()

static Time fromUnixTimestamp ( uint32  seconds)
inlinestaticinherited

Creates a time representation out of a unix timestamp.

Parameters
[in]secondsThe unix timestamp in seconds.

◆ toUnixNS()

uint64 toUnixNS ( ) const
inlineinherited

Converts the current time to a unix timestamp in nanoseconds.

Returns
timestamp in nanoseconds.

◆ fromUnixNS()

static Time fromUnixNS ( uint64  nanoseconds)
inlinestaticinherited

Creates a time representation out of a unix timestamp.

Parameters
[in]nanosecondsThe unix timestamp in nanoseconds.

◆ toLocal()

Time toLocal ( ) const
inlineinherited

Converts to local time zone based on the settings of the machine.

Returns
The time in local time zone.

◆ toTimeZone()

Time toTimeZone ( const std::string &  zone)
inlineinherited

Converts to given time zone.

Parameters
[in]zoneThe time zone to convert to e.g. "CET+1" (= name CET, 1 hour ahead of GMT).
Returns
The time in the requested time zone.

◆ isValid()

bool isValid ( ) const
inlineinherited

Returns true if this contains a valid time.

Returns
true if this is a valid time, false otherwise

◆ operator-() [1/3]

Duration operator- ( const Time t) const
inlineinherited

◆ operator-() [2/3]

Time operator- ( const DateDuration d) const
inlineinherited

◆ operator-() [3/3]

Time operator- ( const Duration d) const
inlineinherited

◆ operator+() [1/2]

Time operator+ ( const DateDuration d) const
inlineinherited

◆ operator+() [2/2]

Time operator+ ( const Duration d) const
inlineinherited

◆ operator+=() [1/2]

Time operator+= ( const DateDuration d)
inlineinherited

◆ operator+=() [2/2]

Time operator+= ( const Duration d)
inlineinherited

◆ operator-=() [1/2]

Time operator-= ( const DateDuration d)
inlineinherited

◆ operator-=() [2/2]

Time operator-= ( const Duration d)
inlineinherited

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