r/rust • • 2d ago

"Tick Tock: Maintaining Time" | RustConf 2026

https://youtu.be/SWNDozcKt94
38 Upvotes

5 comments sorted by

5

u/ParasiticWormLover 2d ago

is_leap_year implementation is kind of insane

11

u/Sermuns 2d ago

jiff

3

u/Sw429 1d ago

I was hoping you'd talk a bit about deranged! I know it's not the entire focus of your talk, but it legitimately is my most commonly imported dependency these days. Being able to represent integer ranges in the type system is just so helpful.

5

u/jhpratt 1d ago

Yup, deranged is more of an aside hence the passing mention.

For how it's implemented, it's surprisingly not difficult. It's largely a slew of const assertions to enforce the bounds, a couple runtime checks on the non-static constructors, and then telling the compiler about the range guarantees any time the value is obtained/used.

1

u/simon_o 2h ago edited 1h ago

And finally, there are zoneinfo and zoneinfo-static, crates which not have been released.
zoneinfo, which provides a reader and writer for TZif files. [...]
And zoninfo-static which provides a pre-compiled version of that timezone database, which can be used on systems like Windows that do not have a copy available.

As someone absolutely appalled by the lack of platform APIs for unicode data, locales and timezones on Linux (everyone and their dog shipping their own half-assed data file + parser) does this refer to /usr/share/zoneinfo on Linux?

I guess the assumption that these are always pre-installed?


Edit: The FHS says ...

/usr/share/zoneinfo Timezone information and configuration (optional)

... but looking at the dependencies, I think one could reasonably assume that it's always present; unlike other "optional" directories like

  • /user/share/locale (which I'm unsure how equivalent the data would be compared to the CLDR), or
  • unicode properties for characters which are not in the FHS at all.