template <intmax_t N, intmax_t D = 1> class ratio;
std::ratio用于实例化由分子和分母表示的有理数,第一个是分子,第二个是分母,这是两个非类型模板参数
template <class Rep, class Period = ratio<1> > class duration;
std::chrono::duration第一个参数是个数,第二个参数是以秒为单位的比率类型,乘起来就是最后总共的秒数
seconds是duration的一个全特化的类
typedef duration<long long,ratio<1>> seconds;
type | Representation | Period |
---|---|---|
hours | signed integral type of at least 23 bits | ratio<3600,1> |
minutes | signed integral type of at least 29 bits | ratio<60,1> |
seconds | signed integral type of at least 35 bits | ratio<1,1> |
milliseconds | signed integral type of at least 45 bits | ratio<1,1000> |
microseconds | signed integral type of at least 55 bits | ratio<1,1000000> |
nanoseconds | signed integral type of at least 64 bits | ratio<1,1000000000> |