3 ms·
> I don't want to have a type for an integer in seconds, a type for an integer in minutes, a type for an integer in days, and so forth. This is not how a typic
by yencabulator 2y ago
> I don't want to have a type for an integer in seconds, a type for an integer in minutes, a type for an integer in days, and so forth.
This is not how a typical Duration type works.
https://pkg.go.dev/time#Duration https://pkg.go.dev/time#Duration
https://doc.rust-lang.org/nightly/core/time/struct.Duration.html https://doc.rust-lang.org/nightly/core/time/struct.Duration....
https://docs.rs/jiff/latest/jiff/struct.SignedDuration.html https://docs.rs/jiff/latest/jiff/struct.SignedDuration.html
- crazygringo 2y agoI'm just saying, this form of "Hungarian" variable names is useful, to always include the unit. Not everything should be a type. If all you're doing is calculating the difference between two calls to time(), it can be much more straightforward to call something "elapsed_s" or "elapsed_ms" instead of going to all the trouble of a Duration type.