PSA: The time crate once again supports obtaining the local offset on Linux

As of a short while ago, the time crate (v0.3.5, specifically) has re-added support for obtaining the system's UTC offset and related methods on Linux. There is one caveat: the process must be single-threaded. If it is, it'll try to determine your offset as it once did; if it's multi-threaded it'll error as it has recently.

You don't need any special flags to enable this — just the local-offset feature as indicated in documentation. Libraries can use this unlike before.

Please note that this does not revert to the previous situation. All of Unix was affected by the soundness bug, while only Linux has this patch. It's a band-aid solution, but I'd rather have a band-aid than an amputation.

1 Like

Was that intended?

Yes. A library could not opt the user into unsound usage of an API as the requirements to guarantee safety are beyond any library's control.

1 Like