Skip to content

Timestamp

class Timestamp

This class expresses a time point and holds it in form of an Epochstamp and Trainstamp

Operators

Name Description
operator== Compare if the Epochstamp and Trainstamp of this Timestamp are the same as those of other other : Return :
operator!= Compare if the Epochstamp and/or Trainstamp of this Timestamp are not the same of other other : Return :

Functions

Name Description
getEpochstamp Return Epochstamp part of the timestamp Return :
getTrainstamp Return Trainstamp part of the timestamp Return :
getSeconds Return the seconds entry of the timestamp Return :
getFractionalSeconds Return the fractional seconds entry of the timestamp Return :
getTrainId Return the train id entry of the timestamp Return :
fromHashAttributes Creates an Timestamp from three Hash attributes This function throws in case the attributes do no provide the correct information attributes : Hash attributes Return : Timestamp object
toIso8601 Generates a sting (respecting ISO-8601) for object time for INTERNAL usage ("%Y%m%dT%H%M%S%f" => "20121225T132536.789333[123456789123]") precision : - Indicates the precision of the fractional seconds (e.g. MILLISEC, MICROSEC, NANOSEC, PICOSEC, FEMTOSEC, ATTOSEC) [Default: MICROSEC] extended : - "true" returns ISO8601 extended string; "false" returns ISO8601 compact string [Default: false] Return : ISO 8601 formatted string (extended or compact)
toIso8601Ext Generates a sting (respecting ISO-8601) for object time for EXTERNAL usage ("%Y%m%dT%H%M%S%f%z" => "20121225T132536.789333[123456789123]Z") precision : - Indicates the precision of the fractional seconds (e.g. MILLISEC, MICROSEC, NANOSEC, PICOSEC, FEMTOSEC, ATTOSEC) [Default: MICROSEC] extended : - "true" returns ISO8601 extended string; "false" returns ISO8601 compact string [Default: false] Return : ISO 8601 formatted string with "Z" in the string end ("Z" means the date time zone is using Coordinated Universal Time - UTC)
toFormattedString Formats to specified format time stored in the object format : The format of the time point (visit strftime for more info: http://www.cplusplus.com/reference/ctime/strftime/) [Default: "%Y-%b-%d %H:%M:%S"] localTimeZone : - String that represents an ISO8601 time zone [Default: "Z" == UTC] Return : formated string in the specified Time Zone
toFormattedStringLocale Formats to specified format time stored in the object localeName : - String that represents the locale to be used [Default: "" == System locale] format : The format of the time point (visit strftime for more info: http://www.cplusplus.com/reference/ctime/strftime/) [Default: "%Y-%b-%d %H:%M:%S"] localTimeZone : - String that represents an ISO8601 time zone [Default: "Z" == UTC] Return : formated string in the specified Time Zone
toTimestamp Generates a timestamp as double with seconds.fractional format (fractional precision == MICROSEC) Function necessary to use in graphs plotting in Python code (MICROSEC precision is enough) Return : A double value with the decimal point indicating fractions of seconds
toHashAttributes Formats as Hash attributes attributes : container to which the time point information is added

Operator Details

operator!=

bool operator!=(const Timestamp& lhs, const Timestamp& rhs)

Compare if the Epochstamp and/or Trainstamp of this Timestamp are not the same of other

other :

Return :

operator==

bool operator==(const Timestamp& lhs, const Timestamp& rhs)

Compare if the Epochstamp and Trainstamp of this Timestamp are the same as those of other

other :

Return :

Function Details

fromHashAttributes

static Timestamp fromHashAttributes(const Hash::Attributes& attributes)

Creates an Timestamp from three Hash attributes This function throws in case the attributes do no provide the correct information

attributes : Hash attributes

Return : Timestamp object

getEpochstamp

inline const Epochstamp& getEpochstamp() const

Return Epochstamp part of the timestamp

Return :

getFractionalSeconds

inline const unsigned long long& getFractionalSeconds() const

Return the fractional seconds entry of the timestamp

Return :

getSeconds

inline const unsigned long long& getSeconds() const

Return the seconds entry of the timestamp

Return :

getTrainId

inline const unsigned long long& getTrainId() const

Return the train id entry of the timestamp

Return :

getTrainstamp

inline const Trainstamp& getTrainstamp() const

Return Trainstamp part of the timestamp

Return :

toFormattedString

std::string toFormattedString(const std::string& format = std::string("%Y-%b-%d %H:%M:%S"), const std::string& localTimeZone = std::string("Z")) const

Formats to specified format time stored in the object

format : The format of the time point (visit strftime for more info: http://www.cplusplus.com/reference/ctime/strftime/) [Default: "%Y-%b-%d %H:%M:%S"]

localTimeZone : - String that represents an ISO8601 time zone [Default: "Z" == UTC]

Return : formated string in the specified Time Zone

toFormattedStringLocale

std::string toFormattedStringLocale(const std::string& localeName = std::string(""), const std::string& format = std::string("%Y-%b-%d %H:%M:%S"), const std::string& localTimeZone = std::string("Z")) const

Formats to specified format time stored in the object

localeName : - String that represents the locale to be used [Default: "" == System locale]

format : The format of the time point (visit strftime for more info: http://www.cplusplus.com/reference/ctime/strftime/) [Default: "%Y-%b-%d %H:%M:%S"]

localTimeZone : - String that represents an ISO8601 time zone [Default: "Z" == UTC]

Return : formated string in the specified Time Zone

toHashAttributes

void toHashAttributes(Hash::Attributes& attributes) const

Formats as Hash attributes

attributes : container to which the time point information is added

toIso8601

std::string toIso8601(TIME_UNITS precision = MICROSEC, bool extended = false) const

Generates a sting (respecting ISO-8601) for object time for INTERNAL usage ("%Y%m%dT%H%M%S%f" => "20121225T132536.789333[123456789123]")

precision : - Indicates the precision of the fractional seconds (e.g. MILLISEC, MICROSEC, NANOSEC, PICOSEC, FEMTOSEC, ATTOSEC) [Default: MICROSEC]

extended : - "true" returns ISO8601 extended string; "false" returns ISO8601 compact string [Default: false]

Return : ISO 8601 formatted string (extended or compact)

toIso8601Ext

std::string toIso8601Ext(TIME_UNITS precision = MICROSEC, bool extended = false) const

Generates a sting (respecting ISO-8601) for object time for EXTERNAL usage ("%Y%m%dT%H%M%S%f%z" => "20121225T132536.789333[123456789123]Z")

precision : - Indicates the precision of the fractional seconds (e.g. MILLISEC, MICROSEC, NANOSEC, PICOSEC, FEMTOSEC, ATTOSEC) [Default: MICROSEC]

extended : - "true" returns ISO8601 extended string; "false" returns ISO8601 compact string [Default: false]

Return : ISO 8601 formatted string with "Z" in the string end ("Z" means the date time zone is using Coordinated Universal Time - UTC)

toTimestamp

double toTimestamp() const

Generates a timestamp as double with seconds.fractional format (fractional precision == MICROSEC) Function necessary to use in graphs plotting in Python code (MICROSEC precision is enough)

Return : A double value with the decimal point indicating fractions of seconds