TimestampConverter Module

Module Contents

class TimestampConverter

Public Functions

TimestampConverter()
~TimestampConverter()
TimestampConverter(TimestampConverter const &other)
TimestampConverter &operator=(TimestampConverter const &other)
bool operator==(TimestampConverter const &other) const
bool operator!=(TimestampConverter const &other) const
void set_input_format(string_type const &format)

Set format string for parsing timestamps.

This format string must adhere to the guidelines in the documentation for Boost’s date/time input format. See the following page:

http://www.boost.org/doc/libs/master/doc/html/date_time/date_time_io.html

Parameters
  • [in] format: Format string for timestamp parsing

string_type input_format() const

Return the current input format.

Return

Format string for timestamp parsing

void set_output_format(string_type const &format)

Set format string for writing timestamps to strings.

This format string must adhere to the guidelines in the documentation for Boost’s date/time input format. See the following page:

http://www.boost.org/doc/libs/master/doc/html/date_time/date_time_io.html

Parameters
  • [in] format: Format string for timestamp output

string_type output_format() const

Return the current output format.

Return

Format string for timestamp output

string_type timestamp_to_string(Timestamp const &timestamp) const

Convert a timestamp to a string.

Convert a timestamp to a string according to the current output format.

Return

String representation of timestamp

Parameters
  • [in] timestamp: Timestamp to write

Timestamp timestamp_from_string(string_type const &time_string) const

Convert a string to a timestamp.

Parse a string to create a timestamp according to the current input format.

Return

Timestamp parsed from string

Parameters
  • [in] time_string: Timestamp represented as string

Private Members

string_type InputFormat
string_type OutputFormat
std::ostringstream OutputBuf
std::istringstream InputBuf