NumCpp  2.11.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Clock.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <chrono>
4 #include <iostream>
5 
6 namespace nc
7 {
11  using Clock = std::chrono::system_clock;
12 
16  using Duration = std::chrono::nanoseconds;
17 
21  using TimePoint = std::chrono::time_point<Clock, Duration>;
22 
30  inline std::ostream& operator<<(std::ostream& os, Duration duration)
31  {
32  os << duration.count() << " nanoseconds";
33  return os;
34  }
35 
43  inline std::ostream& operator<<(std::ostream& os, const TimePoint& timepoint)
44  {
45  os << timepoint.time_since_epoch() << " nanoseconds since epoch";
46  return os;
47  }
48 
49 } // namespace nc
Definition: Cartesian.hpp:40
std::chrono::nanoseconds Duration
Duration Type.
Definition: Clock.hpp:16
std::chrono::system_clock Clock
Clock Type.
Definition: Clock.hpp:11
std::chrono::time_point< Clock, Duration > TimePoint
TimePoint Type.
Definition: Clock.hpp:21
std::ostream & operator<<(std::ostream &os, Duration duration)
Output stream operator for the Duration type.
Definition: Clock.hpp:30