Partager via


<chrono>

Include the standard header <chrono> to define classes and functions that represent and manipulate time durations and time instants.

#include <chrono>

Classes

Name

Description

duration Class

Describes a type that holds a time interval.

steady_clock Class

Represents a steady clock.

time_point Class

Describes a type that represents a point in time.

Structs

Name

Description

common_type Structure

Describes specializations of template class common_type for instantiations of duration and time_point.

duration_values Structure

Provides specific values for the duration template parameter Rep.

system_clock Structure

Represents a clock type that is based on the real-time clock of the system.

treat_as_floating_point Structure

Specifies whether a type can be treated as a floating-point type.

Functions

Name

Description

duration_cast Function

Casts a duration object to a specified type.

time_point_cast Function

Casts a time_point object to a specified type.

Operators

Name

Description

operator- Operator (STL)

Operator for subtraction or negation of duration and time_point objects.

operator!= Operator (STL)

Inequality operator that is used with duration or time_point objects.

operator % Operator (STL)

Operator for modulo operations on duration objects.

operator* Operator (STL)

Multiplication operator for duration objects.

operator/ Operator (STL)

Division operator for duration objects.

operator+ Operator (STL)

Adds duration and time_point objects.

operator< Operator (STL)

Determines whether one duration or time_point object is less than another duration or time_point object.

operator<= Operator (STL)

Determines whether one duration or time_point object is less than or equal to another duration or time_point object.

operator== Operator (STL)

Determines whether two duration objects represent time intervals that have the same length, or whether two time_point objects represent the same point in time.

operator> Operator (STL)

Determines whether one duration or time_point object is greater than another duration or time_point object.

operator>= Operator (STL)

Determines whether one duration or time_point object is greater than or equal to another duration or time_point object.

Predefined Duration Types

For more information about ratio types that are used in the following typedefs, see <ratio>.

Typedef

Description

typedef duration<long long, nano> nanoseconds;

Synonym for a duration type that has a tick period of one nanosecond.

typedef duration<long long, micro> microseconds;

Synonym for a duration type that has a tick period of one microsecond.

typedef duration<long long, milli> milliseconds;

Synonym for a duration type that has a tick period of one millisecond.

typedef duration<long long> seconds;

Synonym for a duration type that has a tick period of one second.

typedef duration<int, ratio<60> > minutes;

Synonym for a duration type that has a tick period of one minute.

typedef duration<int, ratio<3600> > hours;

Synonym for a duration type that has a tick period of one hour.

See Also

Other Resources

C++ Standard Library Header Files