10 #ifndef WPIUTIL_WPI_CHRONO_H
11 #define WPIUTIL_WPI_CHRONO_H
13 #include "wpi/Compiler.h"
32 template <
typename D = std::chrono::nanoseconds>
33 using TimePoint = std::chrono::time_point<std::chrono::system_clock, D>;
36 LLVM_ATTRIBUTE_ALWAYS_INLINE std::time_t toTimeT(TimePoint<> TP) {
37 using namespace std::chrono;
38 return system_clock::to_time_t(
39 time_point_cast<system_clock::time_point::duration>(TP));
43 LLVM_ATTRIBUTE_ALWAYS_INLINE TimePoint<std::chrono::seconds>
44 toTimePoint(std::time_t T) {
45 using namespace std::chrono;
46 return time_point_cast<seconds>(system_clock::from_time_t(T));
50 LLVM_ATTRIBUTE_ALWAYS_INLINE TimePoint<>
51 toTimePoint(std::time_t T, uint32_t nsec) {
52 using namespace std::chrono;
53 return time_point_cast<nanoseconds>(system_clock::from_time_t(T))
59 raw_ostream &
operator<<(raw_ostream &OS, sys::TimePoint<> TP);
63 #endif // WPIUTIL_WPI_CHRONO_H