Time zone v0.1.0
TimeZoneRuleDate
pub struct TimeZoneRuleDate {
pub year: uint16;
pub month: uint16;
pub dayOfWeek: uint16;
pub day: uint16;
pub hour: uint16;
pub minute: uint16;
pub second: uint16;
pub milliseconds: uint16;
}
When a time-zone rule takes effect, in the layout of SYSTEMTIME but read as a rule, not a date.
A rule with year zero recurs every year: in month, on the dayth occurrence of dayOfWeek (Sunday is zero),
where the fifth occurrence means the last, at hour:minute local time. A zero month means the zone has no
daylight time.
See also: https://learn.microsoft.com/en-us/windows/win32/api/timezoneapi/ns-timezoneapi-time_zone_information
Fields
| Name | Type | Description |
|---|---|---|
year | uint16 | The year for a one-time change, or zero for a rule that recurs. |
month | uint16 | The month, 1 through 12, or zero when there is no change. |
dayOfWeek | uint16 | The day of the week, Sunday being zero. |
day | uint16 | Which occurrence of that day in the month, 1 through 5, where 5 is the last. |
hour | uint16 | The hour of the change, in the local time before it. |
minute | uint16 | The minute of the change. |
second | uint16 | The second of the change. |
milliseconds | uint16 | The millisecond of the change. |
TimeZoneInformation
pub struct TimeZoneInformation {
pub bias: int32;
pub standardName: uint16[N];
pub standardDate: TimeZoneRuleDate;
pub standardBias: int32;
pub daylightName: uint16[N];
pub daylightDate: TimeZoneRuleDate;
pub daylightBias: int32;
}
Win32's TIME_ZONE_INFORMATION: a zone's offsets and when its daylight time starts and ends.
Each bias is minutes to add to local time to get UTC, so a zone east of Greenwich has a negative one.
See also: https://learn.microsoft.com/en-us/windows/win32/api/timezoneapi/ns-timezoneapi-time_zone_information
Fields
| Name | Type | Description |
|---|---|---|
bias | int32 | The bias of standard time, in minutes. |
standardName | uint16[N] | The name of standard time, NUL-terminated UTF-16. |
standardDate | TimeZoneRuleDate | When standard time starts. |
standardBias | int32 | What is added to bias during standard time, usually zero. |
daylightName | uint16[N] | The name of daylight time, NUL-terminated UTF-16. |
daylightDate | TimeZoneRuleDate | When daylight time starts. |
daylightBias | int32 | What is added to bias during daylight time, usually -60. |
GetTimeZoneInformation
pub extern func GetTimeZoneInformation(information: *var TimeZoneInformation) -> uint32
Reads the system's current time zone.
Parameters
| Name | Type | Description |
|---|---|---|
information | *var TimeZoneInformation | receives the zone |
Returns: which part of the year it is now, or 0xFFFFFFFF on failure with the reason in GetLastError