![]() |
ImFusion SDK 4.3
|
Utility methods and classes related to date and time representation, including time zones. More...
Utility methods and classes related to date and time representation, including time zones.
Classes | |
| class | TimePoint |
| Class representing a point in time, keeping track of UTC offsets and time zone name, if available. More... | |
Functions | |
| uint64_t | currentMillisecondsSinceEpochUtc () |
| Returns the total number of milliseconds since the configured epoch. | |
| std::chrono::system_clock::time_point | convertToTimePointFromMilliseconds (uint64_t millisecSinceEpochUtc) |
| Converts a millisecond-based timestamp to a chrono time_point. | |
| std::chrono::system_clock::time_point | convertToTimePointFromSeconds (double secSinceEpochUtc) |
| Converts a seconds-based timestamp to a chrono time_point. | |
| std::chrono::system_clock::time_point | convertToTimePointFromYMD (int year, int month, int day) |
| Converts from year, month and day to a chrono time_point. | |
| std::string | formatTimePoint (std::chrono::system_clock::time_point tp, const std::string &fmt="%F %T") |
| Helper function to format a given time point. | |
| std::map< std::string, std::string > | possibleTimeZones (std::chrono::system_clock::time_point utc, std::chrono::minutes offset) |
| Helper function to query all known time zones for a given UTC date and an offset. | |
| std::vector< std::string > | possibleTimeZoneAbbr (std::chrono::system_clock::time_point utc, std::chrono::minutes offset) |
| Helper function to query all unique known time zone abbreviation for a given UTC date and an offset. | |
| std::optional< std::chrono::system_clock::time_point > | convertToTimezoneFromUTC (std::chrono::system_clock::time_point utc, const std::string &timezone) |
| Helper function to convert a time in UTC to a local time in the timezone specified by the timezoneAbbrev parameter. | |
| std::chrono::system_clock::time_point convertToTimePointFromMilliseconds | ( | uint64_t | millisecSinceEpochUtc | ) |
Converts a millisecond-based timestamp to a chrono time_point.
(convention is used in stream data and the timestamp data components)
| std::chrono::system_clock::time_point convertToTimePointFromSeconds | ( | double | secSinceEpochUtc | ) |
Converts a seconds-based timestamp to a chrono time_point.
(convention is used for images and tracking samples)
| std::chrono::system_clock::time_point convertToTimePointFromYMD | ( | int | year, |
| int | month, | ||
| int | day ) |
Converts from year, month and day to a chrono time_point.
| year | Allowed value range is [1900, 2261] |
| month | Allowed value range is [1, 12] |
| day | Allowed value range is [1, 31] |
| std::runtime_error | if the input values cannot be converted |
| std::string formatTimePoint | ( | std::chrono::system_clock::time_point | tp, |
| const std::string & | fmt = "%F %T" ) |
Helper function to format a given time point.
Omits fractions of seconds. Allowed format strings are described here: https://howardhinnant.github.io/date/date.html#duration_io, "to_stream formatting" section
| std::map< std::string, std::string > possibleTimeZones | ( | std::chrono::system_clock::time_point | utc, |
| std::chrono::minutes | offset ) |
Helper function to query all known time zones for a given UTC date and an offset.
The returned map maps from IANA zone names to the standard abbreviation using for display, for instance Europe/Berlin to CET.
| std::vector< std::string > possibleTimeZoneAbbr | ( | std::chrono::system_clock::time_point | utc, |
| std::chrono::minutes | offset ) |
Helper function to query all unique known time zone abbreviation for a given UTC date and an offset.
For a winter date and offset +1h, it will for instance return, possibly among others, the following: +01, CET, MET, WAT.
| std::optional< std::chrono::system_clock::time_point > convertToTimezoneFromUTC | ( | std::chrono::system_clock::time_point | utc, |
| const std::string & | timezone ) |
Helper function to convert a time in UTC to a local time in the timezone specified by the timezoneAbbrev parameter.
If the timezone cannot be identified by the abbreviation, the optional is null.