---
name: "std::chrono"
section: "3cxx"
platform: "linux"
package: "libstdc++-12-doc"
version: "12.4.0-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/std::chrono/3cxx"
---

# std::chrono(3cxx)

ISO C++ 2011 namespace for date and time utilities.

## NAME

std::chrono - ISO C++ 2011 namespace for date and time utilities.

## SYNOPSIS

### Classes

class **duration**\
 `chrono::duration` represents a distance between two points in time  struct **duration\_values**\
 duration\_values  struct **steady\_clock**\
 Monotonic clock.  struct **system\_clock**\
 System clock.  class **time\_point**\
 `chrono::time_point` represents a point in time as measured by a clock  struct **treat\_as\_floating\_point**\

### Typedefs

**using** **days** = **duration**\< int64\_t, **ratio**\< 86400 \> \>\
 days  **using** **file\_clock** = ::std::filesystem::\_\_file\_clock\
 template\<**typename** **\_Duration** \> **using** **file\_time** = **time\_point**\< file\_clock, **\_Duration** \>\
 **using** **gps\_seconds** = **gps\_time**\< **seconds** \>\
 template\<**typename** **\_Duration** \> **using** **gps\_time** = **time\_point**\< **gps\_clock**, **\_Duration** \>\
 **using** **high\_resolution\_clock** = **system\_clock**\
 Highest-resolution clock.  **using** **hours** = **duration**\< int64\_t, **ratio**\< 3600 \> \>\
 hours  **using** **local\_days** = **local\_time**\< **days** \>\
 **using** **local\_seconds** = **local\_time**\< **seconds** \>\
 template\<**typename** **\_Duration** \> **using** **local\_time** = **time\_point**\< local\_t, **\_Duration** \>\
 **using** **microseconds** = **duration**\< int64\_t, **micro** \>\
 microseconds  **using** **milliseconds** = **duration**\< int64\_t, **milli** \>\
 milliseconds  **using** **minutes** = **duration**\< int64\_t, **ratio**\< 60 \> \>\
 minutes  **using** **months** = **duration**\< int64\_t, **ratio**\< 2629746 \> \>\
 months  **using** **nanoseconds** = **duration**\< int64\_t, **nano** \>\
 nanoseconds  **using** **seconds** = **duration**\< int64\_t \>\
 seconds  **using** **sys\_days** = **sys\_time**\< **days** \>\
 **using** **sys\_seconds** = **sys\_time**\< **seconds** \>\
 template\<**typename** **\_Duration** \> **using** **sys\_time** = **time\_point**\< **system\_clock**, **\_Duration** \>\
 **using** **tai\_seconds** = **tai\_time**\< **seconds** \>\
 template\<**typename** **\_Duration** \> **using** **tai\_time** = **time\_point**\< **tai\_clock**, **\_Duration** \>\
 **using** **utc\_seconds** = **utc\_time**\< **seconds** \>\
 template\<**typename** **\_Duration** \> **using** **utc\_time** = **time\_point**\< **utc\_clock**, **\_Duration** \>\
 **using** **weeks** = **duration**\< int64\_t, **ratio**\< 604800 \> \>\
 weeks  **using** **years** = **duration**\< int64\_t, **ratio**\< 31556952 \> \>\
 years

### Functions

template\<**typename** \_Rep , **typename** **\_Period** \> constexpr **enable\_if\_t**\< **numeric\_limits**\< \_Rep \>::is\_signed, **duration**\< \_Rep, **\_Period** \> \> **abs** (**duration**\< \_Rep, **\_Period** \> \_\_d)\
 template\<**typename** **\_ToDur** , **typename** \_Rep , **typename** **\_Period** \> constexpr **\_\_enable\_if\_is\_duration**\< **\_ToDur** \> **ceil** (const **duration**\< \_Rep, **\_Period** \> &\_\_d)\
 template\<**typename** **\_ToDur** , **typename** **\_Clock** , **typename** \_Dur \> constexpr **enable\_if\_t**\< **\_\_is\_duration**\< **\_ToDur** \>::value, **time\_point**\< **\_Clock**, **\_ToDur** \> \> **ceil** (const **time\_point**\< **\_Clock**, \_Dur \> &**\_\_tp**)\
 template\<**typename** **\_ToDur** , **typename** \_Rep , **typename** **\_Period** \> constexpr **\_\_enable\_if\_is\_duration**\< **\_ToDur** \> **duration\_cast** (const **duration**\< \_Rep, **\_Period** \> &\_\_d)\
 template\<**typename** **\_ToDur** , **typename** \_Rep , **typename** **\_Period** \> constexpr **\_\_enable\_if\_is\_duration**\< **\_ToDur** \> **floor** (const **duration**\< \_Rep, **\_Period** \> &\_\_d)\
 template\<**typename** **\_ToDur** , **typename** **\_Clock** , **typename** \_Dur \> constexpr **enable\_if\_t**\< **\_\_is\_duration**\< **\_ToDur** \>::value, **time\_point**\< **\_Clock**, **\_ToDur** \> \> **floor** (const **time\_point**\< **\_Clock**, \_Dur \> &**\_\_tp**)\
 constexpr bool **is\_am** (const **hours** &**\_\_h**) noexcept\
 constexpr bool **is\_pm** (const **hours** &**\_\_h**) noexcept\
 constexpr **hours** **make12** (const **hours** &**\_\_h**) noexcept\
 constexpr **hours** **make24** (const **hours** &**\_\_h**, bool **\_\_is\_pm**) noexcept\
 template\<**typename** **\_ToDur** , **typename** \_Rep , **typename** **\_Period** \> constexpr **enable\_if\_t**\< \_\_and\_\< **\_\_is\_duration**\< **\_ToDur** \>, \_\_not\_\< **treat\_as\_floating\_point**\< **typename** \_ToDur::rep \> \> \>::value, **\_ToDur** \> **round** (const **duration**\< \_Rep, **\_Period** \> &\_\_d)\
 template\<**typename** **\_ToDur** , **typename** **\_Clock** , **typename** \_Dur \> constexpr **enable\_if\_t**\< \_\_and\_\< **\_\_is\_duration**\< **\_ToDur** \>, \_\_not\_\< **treat\_as\_floating\_point**\< **typename** \_ToDur::rep \> \> \>::value, **time\_point**\< **\_Clock**, **\_ToDur** \> \> **round** (const **time\_point**\< **\_Clock**, \_Dur \> &**\_\_tp**)\
 template\<**typename** **\_ToDur** , **typename** **\_Clock** , **typename** \_Dur \> constexpr **\_\_enable\_if\_t**\< **\_\_is\_duration**\< **\_ToDur** \>::value, **time\_point**\< **\_Clock**, **\_ToDur** \> \> **time\_point\_cast** (const **time\_point**\< **\_Clock**, \_Dur \> &\_\_t)\

template\<**typename** **\_Rep1** , **typename** **\_Period1** , **typename** **\_Rep2** , **typename** **\_Period2** \> constexpr **common\_type**\< **duration**\< **\_Rep1**, **\_Period1** \>, **duration**\< **\_Rep2**, **\_Period2** \> \>::type **operator-** (const **duration**\< **\_Rep1**, **\_Period1** \> &**\_\_lhs**, const **duration**\< **\_Rep2**, **\_Period2** \> &**\_\_rhs**)\
 The difference between two durations.

template\<**typename** **\_Rep1** , **typename** **\_Rep2** , **typename** **\_Period** \> constexpr **duration**\< **\_\_common\_rep\_t**\< **\_Rep2**, **\_Rep1** \>, **\_Period** \> **operator\*** (const **\_Rep1** &**\_\_s**, const **duration**\< **\_Rep2**, **\_Period** \> &\_\_d)\
 template\<**typename** **\_Rep1** , **typename** **\_Period** , **typename** **\_Rep2** \> constexpr **duration**\< **\_\_common\_rep\_t**\< **\_Rep1**, **\_\_disable\_if\_is\_duration**\< **\_Rep2** \> \>, **\_Period** \> **operator/** (const **duration**\< **\_Rep1**, **\_Period** \> &\_\_d, const **\_Rep2** &**\_\_s**)\
 template\<**typename** **\_Rep1** , **typename** **\_Period1** , **typename** **\_Rep2** , **typename** **\_Period2** \> constexpr **common\_type**\< **\_Rep1**, **\_Rep2** \>::type **operator/** (const **duration**\< **\_Rep1**, **\_Period1** \> &**\_\_lhs**, const **duration**\< **\_Rep2**, **\_Period2** \> &**\_\_rhs**)\
 template\<**typename** **\_Rep1** , **typename** **\_Period** , **typename** **\_Rep2** \> constexpr **duration**\< **\_\_common\_rep\_t**\< **\_Rep1**, **\_\_disable\_if\_is\_duration**\< **\_Rep2** \> \>, **\_Period** \> **operator%** (const **duration**\< **\_Rep1**, **\_Period** \> &\_\_d, const **\_Rep2** &**\_\_s**)\
 template\<**typename** **\_Rep1** , **typename** **\_Period1** , **typename** **\_Rep2** , **typename** **\_Period2** \> constexpr **common\_type**\< **duration**\< **\_Rep1**, **\_Period1** \>, **duration**\< **\_Rep2**, **\_Period2** \> \>::type **operator%** (const **duration**\< **\_Rep1**, **\_Period1** \> &**\_\_lhs**, const **duration**\< **\_Rep2**, **\_Period2** \> &**\_\_rhs**)\

template\<**typename** **\_Rep1** , **typename** **\_Period1** , **typename** **\_Rep2** , **typename** **\_Period2** \> constexpr bool **operator\<** (const **duration**\< **\_Rep1**, **\_Period1** \> &**\_\_lhs**, const **duration**\< **\_Rep2**, **\_Period2** \> &**\_\_rhs**)\
 template\<**typename** **\_Rep1** , **typename** **\_Period1** , **typename** **\_Rep2** , **typename** **\_Period2** \> constexpr bool **operator!=** (const **duration**\< **\_Rep1**, **\_Period1** \> &**\_\_lhs**, const **duration**\< **\_Rep2**, **\_Period2** \> &**\_\_rhs**)\
 template\<**typename** **\_Rep1** , **typename** **\_Period1** , **typename** **\_Rep2** , **typename** **\_Period2** \> constexpr bool **operator\<=** (const **duration**\< **\_Rep1**, **\_Period1** \> &**\_\_lhs**, const **duration**\< **\_Rep2**, **\_Period2** \> &**\_\_rhs**)\
 template\<**typename** **\_Rep1** , **typename** **\_Period1** , **typename** **\_Rep2** , **typename** **\_Period2** \> constexpr bool **operator\>** (const **duration**\< **\_Rep1**, **\_Period1** \> &**\_\_lhs**, const **duration**\< **\_Rep2**, **\_Period2** \> &**\_\_rhs**)\
 template\<**typename** **\_Rep1** , **typename** **\_Period1** , **typename** **\_Rep2** , **typename** **\_Period2** \> constexpr bool **operator\>=** (const **duration**\< **\_Rep1**, **\_Period1** \> &**\_\_lhs**, const **duration**\< **\_Rep2**, **\_Period2** \> &**\_\_rhs**)\

template\<**typename** **\_Rep1** , **typename** **\_Period1** , **typename** **\_Clock** , **typename** **\_Dur2** \> constexpr **time\_point**\< **\_Clock**, **typename** **common\_type**\< **duration**\< **\_Rep1**, **\_Period1** \>, **\_Dur2** \>::type \> **operator+** (const **duration**\< **\_Rep1**, **\_Period1** \> &**\_\_lhs**, const **time\_point**\< **\_Clock**, **\_Dur2** \> &**\_\_rhs**)\
 Adjust a time point forwards by the given duration.  template\<**typename** **\_Clock** , **typename** **\_Dur1** , **typename** **\_Rep2** , **typename** **\_Period2** \> constexpr **time\_point**\< **\_Clock**, **typename** **common\_type**\< **\_Dur1**, **duration**\< **\_Rep2**, **\_Period2** \> \>::type \> **operator-** (const **time\_point**\< **\_Clock**, **\_Dur1** \> &**\_\_lhs**, const **duration**\< **\_Rep2**, **\_Period2** \> &**\_\_rhs**)\
 Adjust a time point backwards by the given duration.  template\<**typename** **\_Clock** , **typename** **\_Dur1** , **typename** **\_Dur2** \> constexpr **common\_type**\< **\_Dur1**, **\_Dur2** \>::type **operator-** (const **time\_point**\< **\_Clock**, **\_Dur1** \> &**\_\_lhs**, const **time\_point**\< **\_Clock**, **\_Dur2** \> &**\_\_rhs**)\
 The difference between two time points (as a duration)

template\<**typename** **\_Clock** , **typename** **\_Dur1** , **typename** **\_Dur2** \> constexpr bool **operator!=** (const **time\_point**\< **\_Clock**, **\_Dur1** \> &**\_\_lhs**, const **time\_point**\< **\_Clock**, **\_Dur2** \> &**\_\_rhs**)\
 template\<**typename** **\_Clock** , **typename** **\_Dur1** , **typename** **\_Dur2** \> constexpr bool **operator\<** (const **time\_point**\< **\_Clock**, **\_Dur1** \> &**\_\_lhs**, const **time\_point**\< **\_Clock**, **\_Dur2** \> &**\_\_rhs**)\
 template\<**typename** **\_Clock** , **typename** **\_Dur1** , **typename** **\_Dur2** \> constexpr bool **operator\<=** (const **time\_point**\< **\_Clock**, **\_Dur1** \> &**\_\_lhs**, const **time\_point**\< **\_Clock**, **\_Dur2** \> &**\_\_rhs**)\
 template\<**typename** **\_Clock** , **typename** **\_Dur1** , **typename** **\_Dur2** \> constexpr bool **operator\>** (const **time\_point**\< **\_Clock**, **\_Dur1** \> &**\_\_lhs**, const **time\_point**\< **\_Clock**, **\_Dur2** \> &**\_\_rhs**)\
 template\<**typename** **\_Clock** , **typename** **\_Dur1** , **typename** **\_Dur2** \> constexpr bool **operator\>=** (const **time\_point**\< **\_Clock**, **\_Dur1** \> &**\_\_lhs**, const **time\_point**\< **\_Clock**, **\_Dur2** \> &**\_\_rhs**)\

### Variables

constexpr month **April**\
 constexpr month **August**\
 constexpr month **December**\
 constexpr month **February**\
 constexpr weekday **Friday**\
 template\<**typename** \_Tp \> constexpr bool **is\_clock\_v**\
 template\<\> constexpr bool **is\_clock\_v\< file\_clock \>**\
 template\<\> constexpr bool **is\_clock\_v\< gps\_clock \>**\
 template\<\> constexpr bool **is\_clock\_v\< steady\_clock \>**\
 template\<\> constexpr bool **is\_clock\_v\< system\_clock \>**\
 template\<\> constexpr bool **is\_clock\_v\< tai\_clock \>**\
 template\<\> constexpr bool **is\_clock\_v\< utc\_clock \>**\
 constexpr month **January**\
 constexpr month **July**\
 constexpr month **June**\
 constexpr last\_spec **last**\
 constexpr month **March**\
 constexpr month **May**\
 constexpr weekday **Monday**\
 constexpr month **November**\
 constexpr month **October**\
 constexpr weekday **Saturday**\
 constexpr month **September**\
 constexpr weekday **Sunday**\
 constexpr weekday **Thursday**\
 template\<**typename** \_Rep \> constexpr bool **treat\_as\_floating\_point\_v**\
 constexpr weekday **Tuesday**\
 constexpr weekday **Wednesday**\

## Detailed Description

ISO C++ 2011 namespace for date and time utilities.

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
