STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Typedefs | Functions
chrono Namespace Reference

Classes

struct  _Is_duration
 
struct  _Is_duration< duration< _Rep, _Period > >
 
struct  _Is_ratio
 
struct  _Is_ratio< ratio< _R1, _R2 > >
 
class  duration
 
class  duration< duration< _Rep1, _Period1 >, _Period2 >
 
struct  duration_values
 
class  steady_clock
 
struct  system_clock
 
class  time_point
 
struct  treat_as_floating_point
 

Typedefs

typedef duration< long long, nanonanoseconds
 
typedef duration< long long, micromicroseconds
 
typedef duration< long long, millimilliseconds
 
typedef duration< long long > seconds
 
typedef duration< int, ratio< 60 > > minutes
 
typedef duration< int, ratio< 3600 > > hours
 
typedef steady_clock monotonic_clock
 
typedef system_clock high_resolution_clock
 

Functions

template<class _To , class _Rep , class _Period >
enable_if< _Is_duration< _To >::value, _To >::type duration_cast (const duration< _Rep, _Period > &)
 
template<class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
common_type< duration< _Rep1, _Period1 >, duration< _Rep2, _Period2 > >::type operator+ (const duration< _Rep1, _Period1 > &_Left, const duration< _Rep2, _Period2 > &_Right)
 
template<class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
common_type< duration< _Rep1, _Period1 >, duration< _Rep2, _Period2 > >::type operator- (const duration< _Rep1, _Period1 > &_Left, const duration< _Rep2, _Period2 > &_Right)
 
template<class _Rep1 , class _Period1 , class _Rep2 >
enable_if< is_convertible< _Rep2, typename common_type< _Rep1, _Rep2 >::type >::value, duration< typename common_type< _Rep1, _Rep2 >::type, _Period1 > >::type operator* (const duration< _Rep1, _Period1 > &_Left, const _Rep2 &_Right)
 
template<class _Rep1 , class _Rep2 , class _Period2 >
enable_if< is_convertible< _Rep1, typename common_type< _Rep1, _Rep2 >::type >::value, duration< typename common_type< _Rep1, _Rep2 >::type, _Period2 > >::type operator* (const _Rep1 &_Left, const duration< _Rep2, _Period2 > &_Right)
 
template<class _Rep1 , class _Period1 , class _Rep2 >
enable_if< is_convertible< _Rep2, typename common_type< _Rep1, _Rep2 >::type >::value &&!_Is_duration< _Rep2 >::value, duration< typename common_type< _Rep1, _Rep2 >::type, _Period1 > >::type operator/ (const duration< _Rep1, _Period1 > &_Left, const _Rep2 &_Right)
 
template<class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
common_type< _Rep1, _Rep2 >::type operator/ (const duration< _Rep1, _Period1 > &_Left, const duration< _Rep2, _Period2 > &_Right)
 
template<class _Rep1 , class _Period1 , class _Rep2 >
enable_if< is_convertible< _Rep2, typename common_type< _Rep1, _Rep2 >::type >::value &&!_Is_duration< _Rep2 >::value, duration< typename common_type< _Rep1, _Rep2 >::type, _Period1 > >::type operator% (const duration< _Rep1, _Period1 > &_Left, const _Rep2 &_Right)
 
template<class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
common_type< _Rep1, _Rep2 >::type operator% (const duration< _Rep1, _Period1 > &_Left, const duration< _Rep2, _Period2 > &_Right)
 
template<class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
bool operator== (const duration< _Rep1, _Period1 > &_Left, const duration< _Rep2, _Period2 > &_Right)
 
template<class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
bool operator!= (const duration< _Rep1, _Period1 > &_Left, const duration< _Rep2, _Period2 > &_Right)
 
template<class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
bool operator< (const duration< _Rep1, _Period1 > &_Left, const duration< _Rep2, _Period2 > &_Right)
 
template<class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
bool operator<= (const duration< _Rep1, _Period1 > &_Left, const duration< _Rep2, _Period2 > &_Right)
 
template<class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
bool operator> (const duration< _Rep1, _Period1 > &_Left, const duration< _Rep2, _Period2 > &_Right)
 
template<class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
bool operator>= (const duration< _Rep1, _Period1 > &_Left, const duration< _Rep2, _Period2 > &_Right)
 
template<class _Clock , class _Duration , class _Rep , class _Period >
time_point< _Clock, typename common_type< _Duration, duration< _Rep, _Period > >::type > operator+ (const time_point< _Clock, _Duration > &_Left, const duration< _Rep, _Period > &_Right)
 
template<class _Rep , class _Period , class _Clock , class _Duration >
time_point< _Clock, typename common_type< duration< _Rep, _Period >, _Duration >::type > operator+ (const duration< _Rep, _Period > &_Left, const time_point< _Clock, _Duration > &_Right)
 
template<class _Clock , class _Duration , class _Rep , class _Period >
time_point< _Clock, typename common_type< _Duration, duration< _Rep, _Period > >::type > operator- (const time_point< _Clock, _Duration > &_Left, const duration< _Rep, _Period > &_Right)
 
template<class _Clock , class _Duration1 , class _Duration2 >
common_type< _Duration1, _Duration2 >::type operator- (const time_point< _Clock, _Duration1 > &_Left, const time_point< _Clock, _Duration2 > &_Right)
 
template<class _Clock , class _Duration1 , class _Duration2 >
bool operator== (const time_point< _Clock, _Duration1 > &_Left, const time_point< _Clock, _Duration2 > &_Right)
 
template<class _Clock , class _Duration1 , class _Duration2 >
bool operator!= (const time_point< _Clock, _Duration1 > &_Left, const time_point< _Clock, _Duration2 > &_Right)
 
template<class _Clock , class _Duration1 , class _Duration2 >
bool operator< (const time_point< _Clock, _Duration1 > &_Left, const time_point< _Clock, _Duration2 > &_Right)
 
template<class _Clock , class _Duration1 , class _Duration2 >
bool operator<= (const time_point< _Clock, _Duration1 > &_Left, const time_point< _Clock, _Duration2 > &_Right)
 
template<class _Clock , class _Duration1 , class _Duration2 >
bool operator> (const time_point< _Clock, _Duration1 > &_Left, const time_point< _Clock, _Duration2 > &_Right)
 
template<class _Clock , class _Duration1 , class _Duration2 >
bool operator>= (const time_point< _Clock, _Duration1 > &_Left, const time_point< _Clock, _Duration2 > &_Right)
 
template<class _To , class _Clock , class _Duration >
enable_if< _Is_duration< _To >::value, time_point< _Clock, _To > >::type time_point_cast (const time_point< _Clock, _Duration > &_Time)
 

Typedef Documentation

typedef duration<int, ratio<3600> > chrono::hours
typedef duration<long long, micro> chrono::microseconds
typedef duration<long long, milli> chrono::milliseconds
typedef duration<long long, nano> chrono::nanoseconds
typedef duration<long long> chrono::seconds

Function Documentation

template<class _To , class _Rep , class _Period >
enable_if< _Is_duration< _To >::value, _To >::type chrono::duration_cast ( const duration< _Rep, _Period > &  _Dur)
inline
536  { // convert duration to another duration
538  typedef typename _To::rep _ToRep;
539  typedef typename common_type<_ToRep, _Rep, intmax_t>::type _CR;
540  if (_CF::num == 1 && _CF::den == 1)
541  return (_To(static_cast<_ToRep>(_Dur.count())));
542  else if (_CF::num != 1 && _CF::den == 1)
543  return (_To(static_cast<_ToRep>(
544  static_cast<_CR>(_Dur.count()) * static_cast<_CR>(_CF::num))));
545  else if (_CF::num == 1 && _CF::den != 1)
546  return (_To(static_cast<_ToRep>(
547  static_cast<_CR>(_Dur.count()) / static_cast<_CR>(_CF::den))));
548  else
549  return (_To(static_cast<_ToRep>(
550  static_cast<_CR>(_Dur.count()) * static_cast<_CR>(_CF::num)
551  / static_cast<_CR>(_CF::den))));
552  }
typename _Ratio_divide< _R1, _R2 >::type ratio_divide
Definition: ratio:242
template<class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
bool chrono::operator!= ( const duration< _Rep1, _Period1 > &  _Left,
const duration< _Rep2, _Period2 > &  _Right 
)
inline
478  { // test if duration != duration
479  return (!(_Left == _Right));
480  }
const _Ty & _Right
Definition: algorithm:4087
template<class _Clock , class _Duration1 , class _Duration2 >
bool chrono::operator!= ( const time_point< _Clock, _Duration1 > &  _Left,
const time_point< _Clock, _Duration2 > &  _Right 
)
inline
634  { // test for time_point != time_point
635  return (!(_Left == _Right));
636  }
const _Ty & _Right
Definition: algorithm:4087
template<class _Rep1 , class _Period1 , class _Rep2 >
enable_if<is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value && !_Is_duration<_Rep2>::value, duration<typename common_type<_Rep1, _Rep2>::type, _Period1> >::type chrono::operator% ( const duration< _Rep1, _Period1 > &  _Left,
const _Rep2 &  _Right 
)
inline
437  { // divide duration by rep
438  typedef typename common_type<_Rep1, _Rep2>::type _CR;
439  return (duration<_CR, _Period1>(_Left) %= _Right);
440  }
const _Ty & _Right
Definition: algorithm:4087
template<class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
common_type<_Rep1, _Rep2>::type chrono::operator% ( const duration< _Rep1, _Period1 > &  _Left,
const duration< _Rep2, _Period2 > &  _Right 
)
inline
450  { // divide duration by duration
451  typedef typename common_type<
452  duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _CD;
453  return (_CD(_Left).count() % _CD(_Right).count());
454  }
iterator_traits< _InIt >::difference_type count(_InIt _First, _InIt _Last, const _Ty &_Val)
Definition: xutility:3086
const _Ty & _Right
Definition: algorithm:4087
template<class _Rep1 , class _Period1 , class _Rep2 >
enable_if<is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, duration<typename common_type<_Rep1, _Rep2>::type, _Period1> >::type chrono::operator* ( const duration< _Rep1, _Period1 > &  _Left,
const _Rep2 &  _Right 
)
inline
380  { // multiply duration by rep
381  typedef typename common_type<_Rep1, _Rep2>::type _CR;
382  return (duration<_CR, _Period1>(_Left) *= _Right);
383  }
const _Ty & _Right
Definition: algorithm:4087
template<class _Rep1 , class _Rep2 , class _Period2 >
enable_if<is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value, duration<typename common_type<_Rep1, _Rep2>::type, _Period2> >::type chrono::operator* ( const _Rep1 &  _Left,
const duration< _Rep2, _Period2 > &  _Right 
)
inline
394  { // multiply rep by duration
395  return (_Right * _Left);
396  }
const _Ty & _Right
Definition: algorithm:4087
template<class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
common_type< duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type chrono::operator+ ( const duration< _Rep1, _Period1 > &  _Left,
const duration< _Rep2, _Period2 > &  _Right 
)
inline
348  { // add two durations
349  typedef typename common_type<
350  duration<_Rep1, _Period1>,
351  duration<_Rep2, _Period2> >::type _CD;
352  return (_CD(_Left) += _Right);
353  }
const _Ty & _Right
Definition: algorithm:4087
template<class _Clock , class _Duration , class _Rep , class _Period >
time_point<_Clock, typename common_type<_Duration, duration<_Rep, _Period> >::type> chrono::operator+ ( const time_point< _Clock, _Duration > &  _Left,
const duration< _Rep, _Period > &  _Right 
)
inline
572  { // add duration to time_point
573  typedef time_point<_Clock, typename common_type<
574  _Duration, duration<_Rep, _Period> >::type> _RT;
575  return (_RT(_Left) += _Right);
576  }
_In_ unsigned _Duration
Definition: stdlib.h:910
const _Ty & _Right
Definition: algorithm:4087
template<class _Rep , class _Period , class _Clock , class _Duration >
time_point<_Clock, typename common_type<duration<_Rep, _Period>, _Duration>::type> chrono::operator+ ( const duration< _Rep, _Period > &  _Left,
const time_point< _Clock, _Duration > &  _Right 
)
inline
587  { // add time_point to duration
588  return (_Right + _Left);
589  }
const _Ty & _Right
Definition: algorithm:4087
template<class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
common_type< duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type chrono::operator- ( const duration< _Rep1, _Period1 > &  _Left,
const duration< _Rep2, _Period2 > &  _Right 
)
inline
365  { // subtract two durations
366  typedef typename common_type<
367  duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _CD;
368  return (_CD(_Left) -= _Right);
369  }
const _Ty & _Right
Definition: algorithm:4087
template<class _Clock , class _Duration , class _Rep , class _Period >
time_point<_Clock, typename common_type<_Duration, duration<_Rep, _Period> >::type> chrono::operator- ( const time_point< _Clock, _Duration > &  _Left,
const duration< _Rep, _Period > &  _Right 
)
inline
600  { // subtract duration from time_point
601  typedef time_point<_Clock, typename common_type<
602  _Duration, duration<_Rep, _Period> >::type> _RT;
603  return (_RT(_Left) -= _Right);
604  }
_In_ unsigned _Duration
Definition: stdlib.h:910
const _Ty & _Right
Definition: algorithm:4087
template<class _Clock , class _Duration1 , class _Duration2 >
common_type<_Duration1, _Duration2>::type chrono::operator- ( const time_point< _Clock, _Duration1 > &  _Left,
const time_point< _Clock, _Duration2 > &  _Right 
)
inline
613  { // add time_point to time_point
614  return (_Left.time_since_epoch() - _Right.time_since_epoch());
615  }
const _Ty & _Right
Definition: algorithm:4087
template<class _Rep1 , class _Period1 , class _Rep2 >
enable_if<is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value && !_Is_duration<_Rep2>::value, duration<typename common_type<_Rep1, _Rep2>::type, _Period1> >::type chrono::operator/ ( const duration< _Rep1, _Period1 > &  _Left,
const _Rep2 &  _Right 
)
inline
408  { // divide duration by rep
409  typedef typename common_type<_Rep1, _Rep2>::type _CR;
410  return (duration<_CR, _Period1>(_Left) /= _Right);
411  }
const _Ty & _Right
Definition: algorithm:4087
template<class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
common_type<_Rep1, _Rep2>::type chrono::operator/ ( const duration< _Rep1, _Period1 > &  _Left,
const duration< _Rep2, _Period2 > &  _Right 
)
inline
421  { // divide duration by duration
422  typedef typename common_type<
423  duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _CD;
424  return (_CD(_Left).count() / _CD(_Right).count());
425  }
iterator_traits< _InIt >::difference_type count(_InIt _First, _InIt _Last, const _Ty &_Val)
Definition: xutility:3086
const _Ty & _Right
Definition: algorithm:4087
template<class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
bool chrono::operator< ( const duration< _Rep1, _Period1 > &  _Left,
const duration< _Rep2, _Period2 > &  _Right 
)
inline
489  { // test if duration < duration
490  typedef typename common_type<
491  duration<_Rep1, _Period1>,
492  duration<_Rep2, _Period2> >::type _CT;
493  return (_CT(_Left).count() < _CT(_Right).count());
494  }
iterator_traits< _InIt >::difference_type count(_InIt _First, _InIt _Last, const _Ty &_Val)
Definition: xutility:3086
const _Ty & _Right
Definition: algorithm:4087
template<class _Clock , class _Duration1 , class _Duration2 >
bool chrono::operator< ( const time_point< _Clock, _Duration1 > &  _Left,
const time_point< _Clock, _Duration2 > &  _Right 
)
inline
644  { // test for time_point < time_point
645  return (_Left.time_since_epoch() < _Right.time_since_epoch());
646  }
const _Ty & _Right
Definition: algorithm:4087
template<class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
bool chrono::operator<= ( const duration< _Rep1, _Period1 > &  _Left,
const duration< _Rep2, _Period2 > &  _Right 
)
inline
503  { // test if duration <= duration
504  return (!(_Right < _Left));
505  }
const _Ty & _Right
Definition: algorithm:4087
template<class _Clock , class _Duration1 , class _Duration2 >
bool chrono::operator<= ( const time_point< _Clock, _Duration1 > &  _Left,
const time_point< _Clock, _Duration2 > &  _Right 
)
inline
654  { // test for time_point <= time_point
655  return (!(_Right < _Left));
656  }
const _Ty & _Right
Definition: algorithm:4087
template<class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
bool chrono::operator== ( const duration< _Rep1, _Period1 > &  _Left,
const duration< _Rep2, _Period2 > &  _Right 
)
inline
464  { // test if duration == duration
465  typedef typename common_type<
466  duration<_Rep1, _Period1>,
467  duration<_Rep2, _Period2> >::type _CT;
468  return (_CT(_Left).count() == _CT(_Right).count());
469  }
iterator_traits< _InIt >::difference_type count(_InIt _First, _InIt _Last, const _Ty &_Val)
Definition: xutility:3086
const _Ty & _Right
Definition: algorithm:4087
template<class _Clock , class _Duration1 , class _Duration2 >
bool chrono::operator== ( const time_point< _Clock, _Duration1 > &  _Left,
const time_point< _Clock, _Duration2 > &  _Right 
)
inline
624  { // test for time_point == time_point
625  return (_Left.time_since_epoch() == _Right.time_since_epoch());
626  }
const _Ty & _Right
Definition: algorithm:4087
template<class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
bool chrono::operator> ( const duration< _Rep1, _Period1 > &  _Left,
const duration< _Rep2, _Period2 > &  _Right 
)
inline
514  { // test if duration > duration
515  return (_Right < _Left);
516  }
const _Ty & _Right
Definition: algorithm:4087
template<class _Clock , class _Duration1 , class _Duration2 >
bool chrono::operator> ( const time_point< _Clock, _Duration1 > &  _Left,
const time_point< _Clock, _Duration2 > &  _Right 
)
inline
664  { // test for time_point > time_point
665  return (_Right < _Left);
666  }
const _Ty & _Right
Definition: algorithm:4087
template<class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
bool chrono::operator>= ( const duration< _Rep1, _Period1 > &  _Left,
const duration< _Rep2, _Period2 > &  _Right 
)
inline
525  { // test if duration >= duration
526  return (!(_Left < _Right));
527  }
const _Ty & _Right
Definition: algorithm:4087
template<class _Clock , class _Duration1 , class _Duration2 >
bool chrono::operator>= ( const time_point< _Clock, _Duration1 > &  _Left,
const time_point< _Clock, _Duration2 > &  _Right 
)
inline
674  { // test for time_point >= time_point
675  return !(_Left < _Right);
676  }
const _Ty & _Right
Definition: algorithm:4087
template<class _To , class _Clock , class _Duration >
enable_if<_Is_duration<_To>::value, time_point<_Clock, _To> >::type chrono::time_point_cast ( const time_point< _Clock, _Duration > &  _Time)
inline
685  { // convert time_point to duration
686  static_assert(_Is_duration<_To>::value,
687  "time_point_cast can only convert to a duration");
688 
689  return (time_point<_Clock, _To>(
690  duration_cast<_To>(_Time.time_since_epoch())));
691  }