Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/header/chrono"

From cppreference.com
< cpp‎ | header
(+)
 
m (Synospis: todo)
Line 180: Line 180:
 
      
 
      
 
}}
 
}}
 +
 +
{{todo|Class synopses}}

Revision as of 08:27, 14 January 2013

 
 
Standard library headers
Algorithms
<algorithm>
<numeric>
Strings
<cctype>
<cstring>
<cuchar> (C++11)
<cwchar>
<cwctype>
<string_view> (C++17)
<string>
Text processing
<clocale>
<codecvt> (C++11/17/26*)
<locale>
<regex> (C++11)
<text_encoding> (C++26)   
Numerics
<cfenv> (C++11)
<cmath>
<complex>
<linalg> (C++26)
<numbers> (C++20)
<random> (C++11)
<valarray>
Time
<chrono> (C++11)
<ctime>
C compatibility
<ccomplex> (C++11/17/20*)
<ciso646> (until C++20)
<cstdalign> (C++11/17/20*)
<cstdbool> (C++11/17/20*)
<ctgmath> (C++11/17/20*)
 

This header is part of the date and time library.

Contents

Classes

Template:cpp/chrono/dcl list durationTemplate:cpp/chrono/dcl list system clockTemplate:cpp/chrono/dcl list steady clockTemplate:cpp/chrono/dcl list high resolution clockTemplate:cpp/chrono/dcl list time pointTemplate:cpp/chrono/duration/dcl list common typeTemplate:cpp/chrono/time point/dcl list common type
Defined in namespace std::chrono
indicates that a duration is convertible to duration with different tick period
(class template)
constructs zero, min, and max values of a tick count of given type
(class template)
Convenience Typedefs
Defined in namespace std::chrono
std::chrono::nanoseconds duration type with Period std::nano
std::chrono::microseconds duration type with Period std::micro
std::chrono::milliseconds duration type with Period std::milli
std::chrono::seconds duration type with Period std::ratio<1>
std::chrono::minutes duration type with Period std::ratio<60>
std::chrono::hours duration type with Period std::ratio<3600>
Specializations
Defined in namespace std

Functions

Template:cpp/chrono/duration/dcl list operator arith4Template:cpp/chrono/duration/dcl list operator cmpTemplate:cpp/chrono/duration/dcl list duration castTemplate:cpp/chrono/time point/dcl list operator arith2Template:cpp/chrono/time point/dcl list operator cmpTemplate:cpp/chrono/time point/dcl list time point cast
Duration
Defined in namespace std::chrono
Time point
Defined in namespace std::chrono


Synospis

namespace std {
namespace chrono {
 
    // class template duration
    template <class Rep, class Period = ratio<1> > class duration;
 
    // class template time_point
    template <class Clock, class Duration = typename Clock::duration> class time_point;
 
} // namespace chrono
 
// common_type specializations
template <class Rep1, class Period1, class Rep2, class Period2>
    struct common_type<chrono::duration<Rep1, Period1>, chrono::duration<Rep2, Period2>>;
 
template <class Clock, class Duration1, class Duration2>
    struct common_type<chrono::time_point<Clock, Duration1>, chrono::time_point<Clock, Duration2>>;
 
namespace chrono {
 
    // customization traits
    template <class Rep> struct treat_as_floating_point;
    template <class Rep> struct duration_values;
 
    // duration arithmetic
    template <class Rep1, class Period1, class Rep2, class Period2>
        typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
        constexpr operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
    template <class Rep1, class Period1, class Rep2, class Period2>
        typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
        constexpr operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
    template <class Rep1, class Period, class Rep2>
        duration<typename common_type<Rep1, Rep2>::type, Period>
        constexpr operator*(const duration<Rep1, Period>& d, const Rep2& s);
    template <class Rep1, class Rep2, class Period>
        duration<typename common_type<Rep1, Rep2>::type, Period>
        constexpr operator*(const Rep1& s, const duration<Rep2, Period>& d);
    template <class Rep1, class Period, class Rep2>
        duration<typename common_type<Rep1, Rep2>::type, Period>
        constexpr operator/(const duration<Rep1, Period>& d, const Rep2& s);
    template <class Rep1, class Period1, class Rep2, class Period2>
        typename common_type<Rep1, Rep2>::type
        constexpr operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
    template <class Rep1, class Period, class Rep2>
        duration<typename common_type<Rep1, Rep2>::type, Period>
        constexpr operator%(const duration<Rep1, Period>& d, const Rep2& s);
    template <class Rep1, class Period1, class Rep2, class Period2>
        typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
        constexpr operator%(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
 
    // duration comparisons
    template <class Rep1, class Period1, class Rep2, class Period2>
        constexpr bool operator==(const duration<Rep1, Period1>& lhs,
                                    const duration<Rep2, Period2>& rhs);
    template <class Rep1, class Period1, class Rep2, class Period2>
        constexpr bool operator!=(const duration<Rep1, Period1>& lhs,
                                    const duration<Rep2, Period2>& rhs);
    template <class Rep1, class Period1, class Rep2, class Period2>
        constexpr bool operator< (const duration<Rep1, Period1>& lhs,
                                    const duration<Rep2, Period2>& rhs);
    template <class Rep1, class Period1, class Rep2, class Period2>
        constexpr bool operator<=(const duration<Rep1, Period1>& lhs,
                                    const duration<Rep2, Period2>& rhs);
    template <class Rep1, class Period1, class Rep2, class Period2>
        constexpr bool operator> (const duration<Rep1, Period1>& lhs,
                                    const duration<Rep2, Period2>& rhs);
    template <class Rep1, class Period1, class Rep2, class Period2>
        constexpr bool operator>=(const duration<Rep1, Period1>& lhs,
                                    const duration<Rep2, Period2>& rhs);
 
    // duration_cast 
    template <class ToDuration, class Rep, class Period> 
        constexpr ToDuration duration_cast(const duration<Rep, Period>& d); 
 
    // convenience typedefs 
    typedef duration</*signed integer type of at least 64 bits*/, nano>        nanoseconds;
    typedef duration</*signed integer type of at least 55 bits*/, micro>       microseconds;
    typedef duration</*signed integer type of at least 45 bits*/, milli>       milliseconds;
    typedef duration</*signed integer type of at least 35 bits*/ >             seconds;
    typedef duration</*signed integer type of at least 29 bits*/, ratio< 60>>  minutes; 
    typedef duration</*signed integer type of at least 23 bits*/, ratio<3600>> hours; 
 
    // time_point arithmetic
    template <class Clock, class Duration1, class Rep2, class Period2>
        time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
        operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
    template <class Rep1, class Period1, class Clock, class Duration2>
        time_point<Clock, typename common_type<duration<Rep1, Period1>, Duration2>::type>
        operator+(const duration<Rep1, Period1>& lhs, const time_point<Clock, Duration2>& rhs);
    template <class Clock, class Duration1, class Rep2, class Period2>
        time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
        operator-(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
    template <class Clock, class Duration1, class Duration2>
        typename common_type<Duration1, Duration2>::type
        operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
 
    // time_point comparisons
    template <class Clock, class Duration1, class Duration2>
        bool operator==(const time_point<Clock, Duration1>& lhs,
                        const time_point<Clock, Duration2>& rhs);
    template <class Clock, class Duration1, class Duration2>
        bool operator!=(const time_point<Clock, Duration1>& lhs,
                        const time_point<Clock, Duration2>& rhs);
    template <class Clock, class Duration1, class Duration2>
        bool operator< (const time_point<Clock, Duration1>& lhs,
                        const time_point<Clock, Duration2>& rhs);
    template <class Clock, class Duration1, class Duration2>
        bool operator<=(const time_point<Clock, Duration1>& lhs,
                        const time_point<Clock, Duration2>& rhs);
    template <class Clock, class Duration1, class Duration2>
        bool operator> (const time_point<Clock, Duration1>& lhs,
                        const time_point<Clock, Duration2>& rhs);
    template <class Clock, class Duration1, class Duration2>
        bool operator>=(const time_point<Clock, Duration1>& lhs,
                        const time_point<Clock, Duration2>& rhs);
 
    // time_point_cast
    template <class ToDuration, class Clock, class Duration>
        time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
 
    // clocks
    class system_clock;
    class steady_clock;
    class high_resolution_clock;
 
} // namespace chrono
}// namespace std