You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Emscripten supports getting the timezone offset (via libc like this: https://stackoverflow.com/a/13804869/2854284). While not as reliable as using the full TZ DB, it would allow at least many basic TZ functions to work in Emscripten builds.
What about adding a system_fixed function that just returns a timezone offset, and supporting it in Emscripten? A separate function is better so that people only use it if the main system function isn't supported on their platform.
(It would also be possible to support calling JS functions to return the offset directly, but without an EM_JS macro in Rust it wouldn't be seamless for end users, they'd have to manually link a JS file.) (I tried making an EM_JS macro but it was way beyond me!)
The text was updated successfully, but these errors were encountered:
Yeah, so as I said on reddit, this probably isn't going to happen. Making a paved path for returning just a system offset kinda goes right against the core of Jiff philosophy. You can of course get the offset yourself and make a TimeZone::fixed, but I don't think I want to bless that approach. Even with a separate routine. The reason why it's broken is because many time zones (i.e., ones with DST) cannot be expressed by a single offset. And so the time zone returned in this case would likely lead to incorrect arithmetic and/or formatting. It's just a bad experience overall.
I think for me to accept something like, it would need to be a pragmatic trade-off that acknowledges a huge number of people constantly running into this as a problem. So I'll leave this issue open for a bit, but my impression is that this isn't something a lot of folks are hitting.
Note that if you can set an environment variable, like TZ, and make Jiff see it, then you could set it to a POSIX time zone like EST5EDT,M3.2.0,M11.1.0 and Jiff would pick that up. Or just make a TimeZone::posix from a string embedded in your program. I'm guessing this doesn't work for your use case, but I thought it was worth mentioning.
Emscripten supports getting the timezone offset (via libc like this: https://stackoverflow.com/a/13804869/2854284). While not as reliable as using the full TZ DB, it would allow at least many basic TZ functions to work in Emscripten builds.
What about adding a
system_fixed
function that just returns a timezone offset, and supporting it in Emscripten? A separate function is better so that people only use it if the mainsystem
function isn't supported on their platform.(It would also be possible to support calling JS functions to return the offset directly, but without an EM_JS macro in Rust it wouldn't be seamless for end users, they'd have to manually link a JS file.) (I tried making an EM_JS macro but it was way beyond me!)
The text was updated successfully, but these errors were encountered: