ocean.text.util.Time

Functions to format time strings.

Members

Functions

extractTimePeriods
void extractTimePeriods(ulong s, uint years, uint days, uint hours, uint minutes, uint seconds)

Works out the number of multiples of various timespans (years, days, hours, minutes, seconds) in the provided total count of seconds, breaking the seconds count down into constituent parts.

formatDuration
mstring formatDuration(ulong s, mstring output)

Formats a string with the number of years, days, hours, minutes & seconds specified.

formatDurationShort
mstring formatDurationShort(ulong s, mstring output)

Formats a string with the number of years, days, hours, minutes & seconds specified. The string is formatted with short names for the time periods (e.g. 's' instead of 'seconds').

formatTime
mstring formatTime(time_t timestamp, mstring output, cstring format_string)

Formats the given UNIX timestamp into the form specified by the format string. If no format string is given, and the length of the destination output buffer has been set to at least 20 characters, then the timestamp will be formatted into the form 1982-09-15 10:37:29.

formatTimeRef
mstring formatTimeRef(time_t timestamp, mstring output, cstring format_string, uint max_output_len)

Formats the given UNIX timestamp into the form specified by the format string. If no format string is given, then the timestamp will be formatted into the form 1982-09-15 10:37:29.

Meta

License

Boost Software License Version 1.0. See LICENSE_BOOST.txt for details. Alternatively, this file may be distributed under the terms of the Tango 3-Clause BSD License (see LICENSE_BSD.txt for details).