Вопрос

I need to save timezones - along with other data - to a file and read the file from multiple platforms (Linux, WinRT, Windows Phone 8, OS X, Android, iOS). Likely languages are C++, C#, Java, and Objective-C.

Saving the timezone offset as a double is insufficient for my needs, because this loses daylight savings information, which is important. Depending on the date and the timezone, 2 am + 2 hours could be 3 am, 4 am, or 5 am.

Is there a universally supported serializable timezone format?

Это было полезно?

Решение

It seems the best answer is to use IANA/Olson/TZDB time zones (which are supported on the Unix based systems), and convert them for the Windows-based platforms. 2-way conversion seems to be unreliable, so the most feasible option seems to be to replace the default datetime framework in .NET with NodaTime, as described in multiple related questions:

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top