Ability to obtain the system's UTC offset
See bytecodealliance/wasmtime#1200. It would be great to be able to obtain both the system's current UTC offset and the offset at a particular moment in time.
Related?: #25
Any progress with this? By the way, great review from Colin Eberhardt about time zones and IANA: https://blog.scottlogic.com/2021/09/14/120-years-timezone.html
wasi-clocks did not have a goal of implementing timezones. It implemented clock_time_get. There is a similar libc API gettimeofday that is used to surface both the time and timezone. We could consider re-visiting wasi-clocks and add a record for timezone and an API that surfaces it.
Then we would likely want to add to wasi-libc so that the following POSIX code works:
let mut tp = std::mem::MaybeUninit::<libc::timeval>::uninit();
let tz = std::ptr::null_mut::<libc::timezone>();
let is_error = unsafe { libc::gettimeofday(tp.as_mut_ptr(), tz) };
A totally different approach would be to surface a higher-level set of APIs like the Internationalization API Specification. The handle to clock in WASI-clocks gives runtimes a capability-driven approach to allowing system time reads. In this theoretical DateTimeFormat API, it could be a handler to intl or still a clock (as intl will almost definitely need to depend on wasi-clocks). It feels too granular to do this just for getting a timezone. I suggest naming this proposal wasi-intl.