Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | List of all members
icl_core::TimeStamp Class Reference

Represents absolute times. More...

#include <TimeStamp.h>

Inheritance diagram for icl_core::TimeStamp:
Inheritance graph
[legend]

Public Member Functions

String formatIso8601 () const
 
String formatIso8601Basic () const
 
String formatIso8601BasicUTC () const
 
String formatIso8601UTC () const
 
TimeStampfromNow ()
 Set the timestamp to the current system time. More...
 
bool operator!= (const TimeStamp &other) const
 
TimeStampoperator+= (const TimeSpan &span)
 Adds a TimeSpan. More...
 
TimeStampoperator-= (const TimeSpan &span)
 Substracts a TimeSpan. More...
 
bool operator< (const TimeStamp &other) const
 
bool operator<= (const TimeStamp &other) const
 
bool operator== (const TimeStamp &other) const
 
bool operator> (const TimeStamp &other) const
 
bool operator>= (const TimeStamp &other) const
 
void strfLocaltime (char *dest, size_t max_len, const char *format) const
 
void strfTime (char *dest, size_t max_len, const char *format) const
 
 TimeStamp ()
 Standard constructor, creates a null time. More...
 
 TimeStamp (uint64_t sec, uint32_t nsec)
 Constructor, takes a timeval for creation. More...
 
 TimeStamp (const struct timespec &ts)
 
 TimeStamp (time_t timestamp)
 
uint32_t tsNSec () const
 
uint64_t tsSec () const
 
uint32_t tsUSec () const
 

Static Public Member Functions

static TimeStamp fromIso8601BasicUTC (const String &str)
 
static TimeStamp futureMSec (uint64_t msec)
 Returns a time stamp which lies msec ms in the future. More...
 
static TimeStamp maxTime ()
 
static TimeStamp now ()
 

Static Public Attributes

static const TimeStamp cZERO
 

Private Member Functions

TimeStampoperator+= (const TimeStamp &other)
 
 TimeStamp (const TimeBase &base)
 

Additional Inherited Members

- Protected Member Functions inherited from icl_core::TimeBase
void fromTimespec (const struct timespec &time)
 
 TimeBase (int64_t secs=0, int32_t nsecs=0)
 
 TimeBase (const struct timespec &time)
 
int64_t days () const
 Use this function if you want to express the time in days. More...
 
int64_t hours () const
 
int32_t microSeconds () const
 
int32_t milliSeconds () const
 
int64_t minutes () const
 
int32_t nanoSeconds () const
 
void normalizeTime ()
 
bool operator!= (const TimeBase &other) const
 
TimeBaseoperator+= (const TimeBase &span)
 Adds a TimeSpan. More...
 
TimeBaseoperator-= (const TimeBase &span)
 Substracts a TimeSpan. More...
 
bool operator< (const TimeBase &other) const
 
bool operator<= (const TimeBase &other) const
 
bool operator== (const TimeBase &other) const
 
bool operator> (const TimeBase &other) const
 
bool operator>= (const TimeBase &other) const
 
int64_t seconds () const
 
struct timespec systemTimespec () const
 
int32_t tbNSec () const
 Returns the nanosecond part of this time. More...
 
int64_t tbSec () const
 Returns the second part of this time. More...
 
struct timespec timespec () const
 
- Static Protected Member Functions inherited from icl_core::TimeBase
static TimeBase maxTime ()
 
- Protected Attributes inherited from icl_core::TimeBase
int32_t nsecs
 
int64_t secs
 

Detailed Description

Represents absolute times.

Use this class whenever you want to deal with times, as it provides a number of useful operators and functions.

Definition at line 61 of file TimeStamp.h.

Constructor & Destructor Documentation

icl_core::TimeStamp::TimeStamp ( )
inline

Standard constructor, creates a null time.

Definition at line 65 of file TimeStamp.h.

icl_core::TimeStamp::TimeStamp ( uint64_t  sec,
uint32_t  nsec 
)
inline

Constructor, takes a timeval for creation.

Constructor that gets a time in seconds plus nanoseconds.

Definition at line 73 of file TimeStamp.h.

icl_core::TimeStamp::TimeStamp ( const struct timespec ts)
inline

Definition at line 77 of file TimeStamp.h.

icl_core::TimeStamp::TimeStamp ( time_t  timestamp)
inlineexplicit

Definition at line 81 of file TimeStamp.h.

icl_core::TimeStamp::TimeStamp ( const TimeBase base)
inlineprivate

Definition at line 335 of file TimeStamp.h.

Member Function Documentation

String icl_core::TimeStamp::formatIso8601 ( ) const

Return the TimeStamp as a string in ISO 8601 format, in the local timezone.

Note
While TimeStamp uses a 64-bit unsigned integer to store the seconds, the time formatting methods only support 32-bit signed integers and will therefore render TimeStamps beyond 03:14:08 UTC on 19 January 2038 incorrectly.

Definition at line 221 of file TimeStamp.cpp.

String icl_core::TimeStamp::formatIso8601Basic ( ) const

Return the TimeStamp as a string in the ISO 8601 basic format (YYYYMMDDTHHMMSS,fffffffff), in the local timezone.

Note
While TimeStamp uses a 64-bit unsigned integer to store the seconds, the time formatting methods only support 32-bit signed integers and will therefore render TimeStamps beyond 03:14:08 UTC on 19 January 2038 incorrectly.

Definition at line 235 of file TimeStamp.cpp.

String icl_core::TimeStamp::formatIso8601BasicUTC ( ) const

Return the TimeStamp as a string in the ISO 8601 basic format (YYYYMMDDTHHMMSS,fffffffff), in UTC.

Note
While TimeStamp uses a 64-bit unsigned integer to store the seconds, the time formatting methods only support 32-bit signed integers and will therefore render TimeStamps beyond 03:14:08 UTC on 19 January 2038 incorrectly.

Definition at line 249 of file TimeStamp.cpp.

String icl_core::TimeStamp::formatIso8601UTC ( ) const

Return the TimeStamp as a string in ISO 8601 format, in UTC.

Note
While TimeStamp uses a 64-bit unsigned integer to store the seconds, the time formatting methods only support 32-bit signed integers and will therefore render TimeStamps beyond 03:14:08 UTC on 19 January 2038 incorrectly.

Definition at line 228 of file TimeStamp.cpp.

TimeStamp icl_core::TimeStamp::fromIso8601BasicUTC ( const String str)
static

Returns a time stamp parsed from an ISO 8601 basic UTC timestamp (YYYYMMDDTHHMMSS,fffffffff).

Definition at line 125 of file TimeStamp.cpp.

TimeStamp & icl_core::TimeStamp::fromNow ( )

Set the timestamp to the current system time.

Definition at line 195 of file TimeStamp.cpp.

TimeStamp icl_core::TimeStamp::futureMSec ( uint64_t  msec)
static

Returns a time stamp which lies msec ms in the future.

Definition at line 118 of file TimeStamp.cpp.

static TimeStamp icl_core::TimeStamp::maxTime ( )
inlinestatic

Definition at line 285 of file TimeStamp.h.

TimeStamp icl_core::TimeStamp::now ( )
static

This static function returns a TimeStamp that contains the current System time (as UTC).

Definition at line 111 of file TimeStamp.cpp.

bool icl_core::TimeStamp::operator!= ( const TimeStamp other) const
inline

Compares two variables of type TimeStamp.

Returns
true if they are not equal.

Definition at line 233 of file TimeStamp.h.

TimeStamp& icl_core::TimeStamp::operator+= ( const TimeSpan span)
inline

Adds a TimeSpan.

Definition at line 213 of file TimeStamp.h.

TimeStamp & icl_core::TimeStamp::operator+= ( const TimeStamp other)
private

Definition at line 327 of file TimeStamp.cpp.

TimeStamp& icl_core::TimeStamp::operator-= ( const TimeSpan span)
inline

Substracts a TimeSpan.

Definition at line 222 of file TimeStamp.h.

bool icl_core::TimeStamp::operator< ( const TimeStamp other) const
inline

Compares two variables of type TimeStamp.

Returns
true if the first one is earlier than the second one.

Definition at line 250 of file TimeStamp.h.

bool icl_core::TimeStamp::operator<= ( const TimeStamp other) const
inline

Compares two variables of type TimeStamp.

Returns
true if the first one is earlier than or equal to the second one.

Definition at line 267 of file TimeStamp.h.

bool icl_core::TimeStamp::operator== ( const TimeStamp other) const
inline

Compares two variables of type TimeStamp.

Returns
true if they are equal.

Definition at line 241 of file TimeStamp.h.

bool icl_core::TimeStamp::operator> ( const TimeStamp other) const
inline

Compares two variables of type TimeStamp.

Returns
true if the first one is later than the second one.

Definition at line 258 of file TimeStamp.h.

bool icl_core::TimeStamp::operator>= ( const TimeStamp other) const
inline

Compares two variables of type TimeStamp.

Returns
true if the first one is later than or equal to the second one.

Definition at line 276 of file TimeStamp.h.

void icl_core::TimeStamp::strfLocaltime ( char *  dest,
size_t  max_len,
const char *  format 
) const

Return a formatted time string converted to the local timezone.

Note
While TimeStamp uses a 64-bit unsigned integer to store the seconds, the time formatting methods only support 32-bit signed integers and will therefore render TimeStamps beyond 03:14:08 UTC on 19 January 2038 incorrectly.

Definition at line 211 of file TimeStamp.cpp.

void icl_core::TimeStamp::strfTime ( char *  dest,
size_t  max_len,
const char *  format 
) const

Return a formatted time string.

Note
While TimeStamp uses a 64-bit unsigned integer to store the seconds, the time formatting methods only support 32-bit signed integers and will therefore render TimeStamps beyond 03:14:08 UTC on 19 January 2038 incorrectly.

Definition at line 203 of file TimeStamp.cpp.

uint32_t icl_core::TimeStamp::tsNSec ( ) const
inline

Definition at line 283 of file TimeStamp.h.

uint64_t icl_core::TimeStamp::tsSec ( ) const
inline

Definition at line 281 of file TimeStamp.h.

uint32_t icl_core::TimeStamp::tsUSec ( ) const
inline

Definition at line 282 of file TimeStamp.h.

Member Data Documentation

const TimeStamp icl_core::TimeStamp::cZERO
static

Definition at line 332 of file TimeStamp.h.


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


fzi_icl_core
Author(s):
autogenerated on Mon Jun 10 2019 13:17:59