3 ms·
You could use the zero value (t.IsZero()) for that if you wanted to. That might be more confusing than a boolean flag though.
by nulltype 11y ago
You could use the zero value (t.IsZero()) for that if you wanted to. That might be more confusing than a boolean flag though.
- p1mrx 11y agoIsZero works okay as an "infinite past" value, such as marking that a cache entry has already expired, but it's cumbersome to use as an "infinite future" because zero is naturally less than all the timestamps you're likely to encounter. It's also not a great idea to manually define the largest possible timestamp as a sentinel, because Add(Duration) doesn't check for overflow.