On this page
operator+, operator-(std::chrono::time_point)
Defined in header <chrono> |
||
|---|---|---|
| (1) | ||
|
(since C++11) (until C++14) |
|
|
(since C++14) | |
| (2) | ||
|
(since C++11) (until C++14) |
|
|
(since C++14) | |
| (3) | ||
|
(since C++11) (until C++14) |
|
|
(since C++14) | |
| (4) | ||
|
(since C++11) (until C++14) |
|
|
(since C++14) |
Performs add and subtract operations involving a time_point.
1,2) Applies the offset
d to pt. Effectively returns CT(pt.time_since_epoch() + d), where CT is the return type.
3) Applies the offset
d to pt in negative direction. Effectively returns CT(pt.time_since_epoch() - d), where CT is the return type.
4) Computes the difference between
pt_lhs and pt_rhs.
Parameters
| pt | - | a time point to apply the offset to |
| d | - | a time offset |
| pt_lhs, pt_rhs | - | time points to extract difference from |
Return value
1-3) The time point that resulted from applying the offset
d.
4) The duration between the time points.
Exceptions
May throw implementation-defined exceptions.
Example
Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 2739 | C++11 | pt - d behaved erratically for unsigned durations |
behavior corrected |
See also
| modifies the time point by the given duration (public member function) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/chrono/time_point/operator_arith2