mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-11 12:27:14 +02:00
Moving headers into include/sls (#212)
This commit is contained in:
22
slsSupportLib/include/sls/TimeHelper.h
Normal file
22
slsSupportLib/include/sls/TimeHelper.h
Normal file
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include <chrono>
|
||||
|
||||
#include "sls/TypeTraits.h"
|
||||
namespace sls {
|
||||
namespace time {
|
||||
using ns = std::chrono::nanoseconds;
|
||||
using us = std::chrono::microseconds;
|
||||
using ms = std::chrono::milliseconds;
|
||||
using s = std::chrono::seconds;
|
||||
|
||||
// Absolute value of std::chrono::duration
|
||||
template <class Rep, class Period>
|
||||
constexpr std::chrono::duration<Rep, Period>
|
||||
abs(std::chrono::duration<Rep, Period> d) {
|
||||
return d >= d.zero() ? d : -d;
|
||||
}
|
||||
|
||||
static_assert(sizeof(ns) == 8, "ns needs to be 64bit");
|
||||
|
||||
} // namespace time
|
||||
} // namespace sls
|
Reference in New Issue
Block a user