Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions
icl_core::TimeStamp Class Reference

Represents absolute times. More...

#include <TimeStamp.h>

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

List of all members.

Public Member Functions

String formatIso8601 () const
String formatIso8601Basic () const
String formatIso8601BasicUTC () const
String formatIso8601UTC () const
TimeStampfromNow ()
 Set the timestamp to the current system time.
bool operator!= (const TimeStamp &other) const
TimeStampoperator+= (const TimeSpan &span)
 Adds a TimeSpan.
TimeStampoperator-= (const TimeSpan &span)
 Substracts a TimeSpan.
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.
 TimeStamp (uint64_t sec, uint32_t nsec)
 Constructor, takes a timeval for creation.
 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.
static TimeStamp maxTime ()
static TimeStamp now ()

Static Public Attributes

static const TimeStamp cZERO

Private Member Functions

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

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

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) [inline, explicit]

Definition at line 81 of file TimeStamp.h.

icl_core::TimeStamp::TimeStamp ( const TimeBase base) [inline, private]

Definition at line 335 of file TimeStamp.h.


Member Function Documentation

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.

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.

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.

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.

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

Definition at line 125 of file TimeStamp.cpp.

Set the timestamp to the current system time.

Definition at line 195 of file TimeStamp.cpp.

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 ( ) [inline, static]

Reimplemented from icl_core::TimeBase.

Definition at line 285 of file TimeStamp.h.

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.

Definition at line 283 of file TimeStamp.h.

Definition at line 281 of file TimeStamp.h.

Definition at line 282 of file TimeStamp.h.


Member Data Documentation

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 Thu Jun 6 2019 20:22:26