Time Shield Library
C++ library for working with time
|
A comprehensive set of functions for converting timestamps to formatted strings. More...
Functions | |
void | time_shield::process_format_impl (char last_char, size_t repeat_count, ts_t ts, tz_t utc_offset, const DateTimeStruct &dt, std::string &result) |
template<class T = ts_t> | |
const std::string | time_shield::to_string (const std::string &format_str, T timestamp, tz_t utc_offset=0) |
Convert timestamp to string with custom format. | |
template<class T = ts_t> | |
const std::string | time_shield::to_str (const std::string &format_str, T timestamp, tz_t utc_offset=0) |
Alias for to_string function. | |
template<class T = ts_ms_t> | |
const std::string | time_shield::to_string_ms (const std::string &format_str, T timestamp, tz_t utc_offset=0) |
Convert timestamp in milliseconds to string with custom format. | |
template<class T = ts_t> | |
const std::string | time_shield::to_str_ms (const std::string &format_str, T timestamp, tz_t utc_offset=0) |
Alias for to_string function. | |
template<class T = ts_t> | |
const std::string | time_shield::to_iso8601 (T ts) |
Converts a timestamp to an ISO8601 string. | |
template<class T = ts_t> | |
const std::string | time_shield::to_iso8601_date (T ts) |
Converts a timestamp to an ISO8601 date string. | |
template<class T = ts_t> | |
const std::string | time_shield::to_iso8601_time (T ts) |
Converts a timestamp to an ISO8601 time string. | |
template<class T = ts_t> | |
const std::string | time_shield::to_iso8601_time_utc (T ts) |
Converts a timestamp to an ISO8601 UTC time string. | |
template<class T = ts_t> | |
const std::string | time_shield::to_iso8601_utc (T ts) |
Converts a timestamp to an ISO8601 string in UTC format. | |
const std::string | time_shield::to_iso8601_utc_ms (ts_ms_t ts_ms) |
Converts a timestamp in milliseconds to an ISO8601 string in UTC format. | |
const std::string | time_shield::to_iso8601_ms (ts_ms_t ts_ms) |
Converts a timestamp in milliseconds to an ISO8601 string. | |
template<class T = ts_t> | |
const std::string | time_shield::to_iso8601 (T ts, tz_t utc_offset) |
Converts a timestamp to an ISO8601 string with timezone offset. | |
const std::string | time_shield::to_iso8601_ms (ts_ms_t ts_ms, tz_t utc_offset) |
Converts a timestamp in milliseconds to an ISO8601 string with timezone offset. | |
const std::string | time_shield::to_mql5_date_time (ts_t ts) |
Converts a timestamp to a string in MQL5 date and time format. | |
const std::string | time_shield::to_mql5_full (ts_t ts) |
Alias for to_mql5_date_time_str function. | |
const std::string | time_shield::to_mql5_date (ts_t ts) |
Converts a timestamp to a string in MQL5 date format. | |
const std::string | time_shield::to_mql5_time (ts_t ts) |
Converts a timestamp to a string in MQL5 time format. | |
const std::string | time_shield::to_windows_filename (ts_t ts) |
Converts a timestamp in seconds to a Windows-compatible filename format. | |
const std::string | time_shield::to_windows_filename_ms (ts_ms_t ts) |
Converts a timestamp in milliseconds to a Windows-compatible filename format. | |
std::string | time_shield::to_human_readable (ts_t ts) |
Converts a timestamp in seconds to a human-readable format. | |
std::string | time_shield::to_human_readable_ms (ts_ms_t ts) |
Converts a timestamp in milliseconds to a human-readable format. | |
const std::string | time_shield::time_zone_struct_to_string (const TimeZoneStruct &tz) |
Converts a TimeZoneStruct to a string representation. | |
const std::string | time_shield::to_string (const TimeZoneStruct &tz) |
Alias for time_zone_struct_to_string function. | |
const std::string | time_shield::to_str (const TimeZoneStruct &tz) |
Alias for time_zone_struct_to_string function. | |
A comprehensive set of functions for converting timestamps to formatted strings.
This module provides utilities for formatting timestamps into human-readable strings, custom formats, ISO8601, and other standardized formats.
strftime
-like specifiers.
|
inline |
Definition at line 48 of file time_formatting.hpp.
|
inline |
Converts a TimeZoneStruct to a string representation.
tz | The TimeZoneStruct to convert. |
Definition at line 66 of file time_zone_struct.hpp.
std::string time_shield::to_human_readable | ( | ts_t | ts | ) |
Converts a timestamp in seconds to a human-readable format.
timestamp_ms | The timestamp in seconds. |
Definition at line 777 of file time_formatting.hpp.
std::string time_shield::to_human_readable_ms | ( | ts_ms_t | ts | ) |
Converts a timestamp in milliseconds to a human-readable format.
timestamp_ms | The timestamp in milliseconds. |
Definition at line 787 of file time_formatting.hpp.
|
inline |
Converts a timestamp to an ISO8601 string.
This function converts a timestamp to a string in ISO8601 format.
T | The type of the timestamp (default is ts_t). |
ts | The timestamp to convert. |
Definition at line 552 of file time_formatting.hpp.
|
inline |
Converts a timestamp to an ISO8601 string with timezone offset.
This function converts a timestamp to a string in ISO8601 format with timezone offset.
T | The type of the timestamp (default is ts_t). |
ts | The timestamp to convert. |
utc_offset | The timezone offset in seconds. |
Definition at line 670 of file time_formatting.hpp.
|
inline |
Converts a timestamp to an ISO8601 date string.
This function converts the date part of a timestamp to a string in ISO8601 format.
T | The type of the timestamp (default is ts_t). |
ts | The timestamp to convert. |
Definition at line 571 of file time_formatting.hpp.
|
inline |
Converts a timestamp in milliseconds to an ISO8601 string.
This function converts a timestamp in milliseconds to a string in ISO8601 format.
ts_ms | The timestamp in milliseconds to convert. |
Definition at line 654 of file time_formatting.hpp.
Converts a timestamp in milliseconds to an ISO8601 string with timezone offset.
This function converts a timestamp in milliseconds to a string in ISO8601 format with timezone offset.
ts_ms | The timestamp in milliseconds to convert. |
utc_offset | The timezone offset in seconds. |
Definition at line 697 of file time_formatting.hpp.
|
inline |
Converts a timestamp to an ISO8601 time string.
This function converts the time part of a timestamp to a string in ISO8601 format.
T | The type of the timestamp (default is ts_t). |
ts | The timestamp to convert. |
Definition at line 586 of file time_formatting.hpp.
|
inline |
Converts a timestamp to an ISO8601 UTC time string.
This function converts the time part of a timestamp to a string in ISO8601 format with 'Z' indicating UTC.
T | The type of the timestamp (default is ts_t). |
ts | The timestamp to convert. |
Definition at line 605 of file time_formatting.hpp.
|
inline |
Converts a timestamp to an ISO8601 string in UTC format.
This function converts a timestamp to a string in ISO8601 format with UTC timezone.
T | The type of the timestamp (default is ts_t). |
ts | The timestamp to convert. |
Definition at line 624 of file time_formatting.hpp.
|
inline |
Converts a timestamp in milliseconds to an ISO8601 string in UTC format.
This function converts a timestamp in milliseconds to a string in ISO8601 format with UTC timezone.
ts_ms | The timestamp in milliseconds to convert. |
Definition at line 641 of file time_formatting.hpp.
|
inline |
Converts a timestamp to a string in MQL5 date format.
This function converts a timestamp to a string in MQL5 date format (yyyy.mm.dd).
ts | The timestamp to convert. |
Definition at line 734 of file time_formatting.hpp.
|
inline |
Converts a timestamp to a string in MQL5 date and time format.
This function converts a timestamp to a string in MQL5 date and time format (yyyy.mm.dd hh:mm:ss).
ts | The timestamp to convert. |
Definition at line 715 of file time_formatting.hpp.
|
inline |
Alias for to_mql5_date_time_str function.
Definition at line 724 of file time_formatting.hpp.
|
inline |
Converts a timestamp to a string in MQL5 time format.
This function converts a timestamp to a string in MQL5 time format (hh:mm:ss).
ts | The timestamp to convert. |
Definition at line 747 of file time_formatting.hpp.
|
inline |
Alias for to_string function.
Convert timestamp to string with custom format.
This function is similar to the strftime function and supports the majority of its specifiers, as well as additional ones: YY, YYYY, YYYYYY, WWW, www, hh, mm, ss, dd, sss.
The function accepts the following format specifiers as parameters:
For more information, see the strftime specifiers documentation:
format_str | Format string with custom parameters, e.g., "%H:%M:%S". |
timestamp | Timestamp. |
utc_offset | UTC offset in seconds (default is 0). |
Definition at line 454 of file time_formatting.hpp.
|
inline |
Alias for time_zone_struct_to_string function.
Converts a TimeZoneStruct to a string representation.
tz | The TimeZoneStruct to convert. |
Definition at line 83 of file time_zone_struct.hpp.
|
inline |
Alias for to_string function.
Convert timestamp to string with custom format.
This function is similar to the strftime function and supports the majority of its specifiers, as well as additional ones: YY, YYYY, YYYYYY, WWW, www, hh, mm, ss, dd, sss.
The function accepts the following format specifiers as parameters:
For more information, see the strftime specifiers documentation:
format_str | Format string with custom parameters, e.g., "%H:%M:%S". |
timestamp | Timestamp. |
utc_offset | UTC offset in seconds (default is 0). |
Definition at line 537 of file time_formatting.hpp.
const std::string time_shield::to_string | ( | const std::string & | format_str, |
T | timestamp, | ||
tz_t | utc_offset = 0 ) |
Convert timestamp to string with custom format.
This function is similar to the strftime function and supports the majority of its specifiers, as well as additional ones: YY, YYYY, YYYYYY, WWW, www, hh, mm, ss, dd, sss.
The function accepts the following format specifiers as parameters:
For more information, see the strftime specifiers documentation:
format_str | Format string with custom parameters, e.g., "%H:%M:%S". |
timestamp | Timestamp. |
utc_offset | UTC offset in seconds (default is 0). |
Definition at line 405 of file time_formatting.hpp.
|
inline |
Alias for time_zone_struct_to_string function.
Converts a TimeZoneStruct to a string representation.
tz | The TimeZoneStruct to convert. |
Definition at line 75 of file time_zone_struct.hpp.
const std::string time_shield::to_string_ms | ( | const std::string & | format_str, |
T | timestamp, | ||
tz_t | utc_offset = 0 ) |
Convert timestamp in milliseconds to string with custom format.
This function is similar to the strftime function and supports the majority of its specifiers, as well as additional ones: YY, YYYY, YYYYYY, WWW, www, hh, mm, ss, dd, sss.
The function accepts the following format specifiers as parameters:
For more information, see the strftime specifiers documentation:
format_str | Format string with custom parameters, e.g., "%H:%M:%S". |
timestamp | Timestamp in milliseconds. |
utc_offset | UTC offset in seconds (default is 0). |
Definition at line 488 of file time_formatting.hpp.
|
inline |
Converts a timestamp in seconds to a Windows-compatible filename format.
timestamp_ms | The timestamp in seconds. |
Definition at line 757 of file time_formatting.hpp.
|
inline |
Converts a timestamp in milliseconds to a Windows-compatible filename format.
timestamp_ms | The timestamp in milliseconds. |
Definition at line 767 of file time_formatting.hpp.