sys_info
struct
Provides a low-level interface to time zone information.
struct sys_info;
Provides a low-level interface to time zone information about the result of converting a sys_time
to a local_time
.
Function | Description |
---|---|
abbrev |
The abbreviation used for the associated time_zone and time_point . |
begin , end |
The range that the offset and abbrev apply to for the associated time zone. |
offset |
The Universal Time Coordinated (UTC) offset in effect for the associated time_zone and time_point . |
save |
Daylight savings time adjustment offset. |
Function | Description |
---|---|
operator<< |
Output a sys_info to a stream. |
The abbreviation used for the associated time_zone
and time_point
.
string abbrev;
The abbreviation.
Abbreviations aren't unique among the time_zone
s. This means you can't reliably map abbreviations back to a time_zone
and UTC offset.
Provides the range over the associated time zone, [begin, end)
, that the offset
and abbrev
apply to.
sys_seconds begin;
sys_seconds end;
The returned sys_seconds
are offsets relative to the associated time_point
.
The UTC offset in effect for the associated time zone and time_point
.
seconds offset;
The relationship between local_time
and sys_time
is: offset = local_time - sys_time
.
Indicates whether the sys_info
is on daylight savings time, and if so, suggests the offset this time zone might use if it weren't on daylight savings time.
minutes save;
If save != 0min
, the time zone is on daylight saving time at the associated time_point
. In that case, offset-save
suggests what offset this time_zone
might use if it not on daylight saving time.
This offset isn't authoritative. To get an authoritative offset, compare with a query against time zone using a time_point
that doesn't fall during daylight savings time. That is, compare against a time_point
that results in a save
value of zero.
// compile using: /std:c++latest
#include <iostream>
#include <chrono>
using namespace std::chrono;
int main()
{
sys_time<system_clock::duration> st = system_clock::now();
const auto& timeZoneDatabase = get_tzdb();
const auto& currentZone = timeZoneDatabase.current_zone();
auto sysInfo = currentZone->get_info(st);
std::cout << sysInfo << "\n";
return 0;
}
begin: 2021-03-14 10:00:00, end: 2021-11-07 09:00:00, offset: -25200s, save: 60min, abbrev: PDT
Header: <chrono>
Namespace: std::chrono
Compiler Option: /std:c++latest
<chrono>
file_clock class
high_resolution_clock
local_t
struct
system_clock
struct
tai_clock
class
utc_clock
class
Header Files Reference