/*signed integer type of at least 55 bits*/
/*signed integer type of at least 45 bits*/
/*signed integer type of at least 23 bits*/
/*signed integer type of at least 29 bits*/
This page has been accessed 733,310 times.
It consists of a count of ticks of typeRepand a tick period, where the tick period is a compile-time rational constant representing the number of seconds from one tick to the next.
This example shows how to define several custom duration types and convert between types:
// integer scale conversion with precision loss: requires a cast
classPeriod=std::ratio1
This page was last modified on 24 March 2018, at 14:30.
Class templatestd::chrono::durationrepresents a time interval.
Note: the literal suffixesdandydo not refer todaysandyearsbut todayandyear, respectively.
/*signed integer type of at least 25 bits*/
/*signed integer type of at least 20 bits*/
1 second is: 1000000 microseconds 100000000 shakes 100 jiffies 0 minutes 0.82672 microfortnights 0.316887 nanocenturies
Each of the predefined duration typesdays,weeks,monthsandyearscovers a range of at least 40000 years.yearsis equal to 365.2425days(the average length of a Gregorian year).monthsis equal to 30.436875days(exactly 1/12 ofyears).
// floating-point scale conversion: no cast
/*signed integer type of at least 17 bits*/
Note: each of the predefined duration types up tohourscovers a range of at least 292 years.
/*signed integer type of at least 22 bits*/
// integer scale conversion with no precision loss: no cast
The only data stored in adurationis a tick count of typeRep. IfRepis floating point, then thedurationcan represent fractions of ticks.Periodis included as part of the durations type, and is only used when converting between different durations.
/*signed integer type of at least 64 bits*/
// seconds in average Gregorian year
/*signed integer type of at least 35 bits*/