Dear All, Last week I found an issue about R Sys.timezone function on Windows and send email to this list. This week , I read quite a few docs and codes about windows time zone to IANA time zone conversion. and found in unicode.org's ICU library has a function ucal_getTimeZoneIDForWindowsID which do the time zone convert. Microsoft also use it for time zone convertion in dotnet 6 and 7.(https://github.com/dotnet/runtime/blob/main/src/native/libs/System.Globalization.Native/pal_timeZoneInfo.c) .
IMHO, use this function to implement time zone convert on windows is better than R's hand-write conversion implementation, use the ICU , it will update the conversion when unicode org upgrade the ICU library and no more hand-write conversion code needed. Also RTools already included the ICU library,and R on windows build link ICU lib on default , so no additional library or tools need for use this function for time zone conversion. so I wrote a quick and dirty patch use the ucal_getTimeZoneIDForWindowsID, I think maybe better discuss here before I send patch to bugs.r-project.org. I put the patch on https://github.com/armgong/misc-r-patch/blob/main/registryTZ-ICU.diff. this patch mainly do following three steps : 1 read current English time zone name from registry ; 2 read current region name from registry(this also affect conversion); 3 use ucal_getTimeZoneIDForWindowsID implement the conversion. please feel free to share your thoughts or feedbacks of this patch. if it doable ,then I will modify it and send it to bugs.r-project.org best regards, Yu Gong [[alternative HTML version deleted]] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel