3 ms·
x = 86400 If I were forced not to write comments, I'd write that as x = 24 * 60 * 60 and let the compiler optimize that.
by gus_massa 2y ago
x = 86400
If I were forced not to write comments, I'd write that as
x = 24 * 60 * 60
and let the compiler optimize that.
- hansvm 2y agoWhen writing it inline, I like this approach. I like even better when these things have names. Something like `std.time.s_per_day` or `time_utils.s_per_day`. Then in the one place they're defined, use a pattern like the above to make them easy to reason about.
- DanHulton 2y agoOne step further: DAY_IN_SECONDS = 24 * 60 * 60
- throwaway14356 2y agoSECONDS_PER_MINUTE = 60; MINUTES_PER_HOUR = 60; HOURS_PER_DAY = 24; DAYS_PER_SECOND = SECONDS_PER_MINUTE * MINUTES_PER_HOUR * HOURS_PER_DAY
- CRConrad 2y ago> DAYS_PER_SECOND = SECONDS_PER_MINUTE * MINUTES_PER_HOUR * HOURS_PER_DAY Naah. DAYS_PER_SECOND = 1 / (SECONDS_PER_MINUTE * MINUTES_PER_HOUR * HOURS_PER_DAY) ;