Yuri6037 / time-tz

Implementation of tz database (IANA) for time Rust crate.
BSD 3-Clause "New" or "Revised" License
22 stars 7 forks source link

Fixed wrong handling of GetDynamicTimeZoneInformation #11

Closed picoHz closed 2 years ago

picoHz commented 2 years ago

get_timezone() always returns Error::Undetermined unless summer time is used in the current locale.

According to Documentation:

Return value

If the function succeeds, it returns one of the following values. Return code/value Description
TIME_ZONE_ID_UNKNOWN 0 Daylight saving time is not used in the current time zone, because there are no transition dates.

Code 0 means success so you have to return the fetched timezone instead of Error::Undetermined.

Yuri6037 commented 2 years ago

Thanks for this. I didn't test that much the windows implementation so I couldn't notice this. I think the doc is a bit confusing because the doc mentions "UNKNOWN" which I assumed meant the system time zone wasn't defined by an identifier which can be looked up into the windows to IANA database.

EDIT: Can you fix the build error?

picoHz commented 2 years ago

I'd checked without system feature😅. Fixed the build error.