Namespaces
Variants
Views
Actions

operator+, operator-(std::time_point)

From cppreference.com
< cpp‎ | chrono‎ | time point
Revision as of 13:22, 5 June 2013 by P12 (Talk | contribs)

template< class C, class D1, class R2, class P2 >

time_point<C, typename std::common_type<D1, duration<R2,P2>>::type>
    operator+( const time_point<C,D1>& pt,

               const duration<R2,P2>& d );
(1) (since C++11)
template< class R1, class P1, class C, class D2 >

time_point<C, typename std::common_type<duration<R1,P1>,D2>::type>
    operator+( const duration<R1,P1>& d,

               const time_point<C,D2>& pt );
(2) (since C++11)
template< class C, class D1, class R2, class P2 >

time_point<C, typename std::common_type<D1, duration<R2,P2>>::type>
    operator-( const time_point<C,D1>& d,

               const duration<R2,P2>& pt );
(3) (since C++11)
template< class C, class D1, class D2 >

time_point<C, typename std::common_type<D1,D2>::type>
    operator-( const time_point<C,D1>& pt_lhs,

               const time_point<C,D2>& pt_rhs );
(4) (since C++11)

Performs add and subtract operations involving a time_point.

1-2) Applies the offset d to pt. Effectively pt += dur is performed.
3) Applies the offset d to pt in negative direction. Effectively pt += (-dur) is performed.
4) Computes the difference between pt_lhs and pt_rhs.

Contents

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

(none)

See also

modifies the time point by the given duration
(public member function) [edit]