Date and Time related converters.
Definition in file datetime.hpp.
|
std::chrono::system_clock::time_point | utils::datetime::Now () noexcept |
| std::chrono::system_clock::now() that could be mocked
|
|
std::chrono::system_clock::time_point | utils::datetime::Epoch () noexcept |
| Returns std::chrono::system_clock::time_point from the start of the epoch.
|
|
std::chrono::steady_clock::time_point | utils::datetime::SteadyNow () noexcept |
| std::chrono::steady_clock::now() that could be mocked
|
|
bool | utils::datetime::IsTimeBetween (int hour, int min, int hour_from, int min_from, int hour_to, int min_to, bool include_time_to=false) noexcept |
| Returns true if the time is in range; works over midnight too.
|
|
std::string | utils::datetime::Timestring (std::time_t timestamp, const std::string &timezone=kDefaultTimezone, const std::string &format=kDefaultFormat) |
| Returns time in a string of specified format.
|
|
std::string | utils::datetime::LocalTimezoneTimestring (std::time_t timestamp, const std::string &format=kDefaultFormat) |
| Returns time in a string of specified format.
|
|
std::string | utils::datetime::Timestring (std::chrono::system_clock::time_point tp, const std::string &timezone=kDefaultTimezone, const std::string &format=kDefaultFormat) |
| Returns time in a string of specified format.
|
|
std::string | utils::datetime::LocalTimezoneTimestring (std::chrono::system_clock::time_point tp, const std::string &format=kDefaultFormat) |
| Returns time in a string of specified format.
|
|
std::chrono::system_clock::time_point | utils::datetime::Stringtime (const std::string ×tring, const std::string &timezone=kDefaultTimezone, const std::string &format=kDefaultFormat) |
| Extracts time point from a string of a specified format.
|
|
std::chrono::system_clock::time_point | utils::datetime::LocalTimezoneStringtime (const std::string ×tring, const std::string &format=kDefaultFormat) |
| Extracts time point from a string of a specified format.
|
|
std::chrono::system_clock::time_point | utils::datetime::GuessStringtime (const std::string ×tamp, const std::string &timezone) |
| Extracts time point from a string, guessing the format.
|
|
std::chrono::system_clock::time_point | utils::datetime::GuessLocalTimezoneStringtime (const std::string ×tamp) |
| Extracts time point from a string, guessing the format.
|
|
std::optional< std::chrono::system_clock::time_point > | utils::datetime::OptionalStringtime (const std::string ×tring, const std::string &timezone=kDefaultTimezone, const std::string &format=kDefaultFormat) |
| Returns optional time in a string of specified format.
|
|
std::time_t | utils::datetime::Timestamp (std::chrono::system_clock::time_point tp) noexcept |
| Converts time point to std::time_t.
|
|
std::time_t | utils::datetime::Timestamp () noexcept |
| Returned current time as std::time_t; could be mocked.
|
|
std::uint32_t | utils::datetime::ParseDayTime (const std::string &str) |
| Parse day time in hh:mm[:ss] format.
|
|
cctz::civil_second | utils::datetime::Localize (const std::chrono::system_clock::time_point &tp, const std::string &timezone) |
| Converts absolute time in std::chrono::system_clock::time_point to a civil time of a particular timezone.
|
|
cctz::civil_second | utils::datetime::LocalTimezoneLocalize (const std::chrono::system_clock::time_point &tp) |
| Converts absolute time in std::chrono::system_clock::time_point to a civil time of a local timezone.
|
|
std::time_t | utils::datetime::Unlocalize (const cctz::civil_second &local_tp, const std::string &timezone) |
| Converts a civil time in a specified timezone into an absolute time.
|
|
std::time_t | utils::datetime::LocalTimezoneUnlocalize (const cctz::civil_second &local_tp) |
| Converts a civil time in a local timezone into an absolute time.
|
|
std::string | utils::datetime::TimestampToString (std::time_t timestamp) |
| Returns string with time in ISO8601 format "YYYY-MM-DDTHH:MM:SS+0000".
|
|
std::int64_t | utils::datetime::TimePointToTicks (const std::chrono::system_clock::time_point &tp) noexcept |
| Convert time_point to DotNet ticks.
|
|
std::chrono::system_clock::time_point | utils::datetime::TicksToTimePoint (std::int64_t ticks) noexcept |
| Convert DotNet ticks to a time point.
|
|
template<class Duration , class Clock > |
double | utils::datetime::CalcTimeDiff (const std::chrono::time_point< Clock > &a, const std::chrono::time_point< Clock > &b) |
| Compute (a - b) with a specified duration.
|
|