this post was submitted on 30 Oct 2025
62 points (100.0% liked)
Rust
7466 readers
24 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
But a day does have exactly 24 hours, at least when using Unix timestamps. Leap seconds aren't accounted for in a Unix timestamp, and Unix timestamps assume UTC timezone, which doesn't have daylight savings.
If you don't make a "from_days()" or "DAYS" constant, people will make their own and they'll be wrong in exactly the same way as if that function or constant was defined in the stdlib, but at least in the stdlib, you have the opportunity to centralize the documentation for it and maybe educate that junior dev before they make a mistake.