I am writing some timekeeping code for the ESP32 in C. I want to display the time in a time zone determined at build time. The ESP32 docs show how to apply a timezone, but the format of the timezone must be in the POSIX.1 format, eg. for Sydney, Australia this is: AEST-10AEDT,M10.1.0/2,M4.1.0/2 I'd like to be able to specify the timezone at build time as the IANA/Olson database name eg. Australia/Sydney, and convert it to the POSIX.1 format for use in the code. The ESP32 build system uses CMake and an sdkconfig file, so this means either a macro defined via CMake or a line inserted into sdkconfig eg. CONFIG_TIMEZONE=AEST-10AEDT,M10.1.0/2,M4.1.0/2 Is there a table or database I could look this up in, or a cross-platform utility that can do the conversion? The ESP IDF toolchain relies heavily on Python (2.7), so even something in Python could work. The less difficulty in integrating this into the build, the better. I just cannot find anything in the way of standalone utilities or cross platform libraries that are easy to wrap and call from CMake. (I am aware that the POSIX.1 format contains less information than the IANA data, and I'd be happy simply with a POSIX.1 expression that gives the current behaviour re. UTC offset and daylight savings.) Continue reading...