Why std::chrono::day stored value is unspecified if d > 255

Viewed 79
1 Answers

The literal can't store more than std::chrono::day itself can, which is 0-255. This allows it to be implemented as a 1 byte data type, which as it usually will only store values between 1 and 31 is sufficient.

If you're looking for a data type to store a duration of an arbitrary number of days use std::chrono::days instead.

Related