SoundBand/Sync/chronotime.h

39 lines
863 B
C
Raw Normal View History

2017-12-17 01:23:38 +03:00
#ifndef CHRONOTIME_H
#define CHRONOTIME_H
#include <chrono>
#include "config.h"
/**
* @brief Time_point on nanosecunds (uint64_t)
*/
typedef long long milliseconds;
typedef std::chrono::time_point<std::chrono::high_resolution_clock> Clock;
class ChronoTime
{
2018-08-16 09:46:47 +03:00
private :
static milliseconds stdTime();
static milliseconds qtTime();
2017-12-17 01:23:38 +03:00
public:
ChronoTime();
/**
* @brief now - get now time on microsecunds
* @return - count of microsecunds
*/
2018-08-16 09:13:18 +03:00
static milliseconds now(milliseconds calibration = 0);
2017-12-17 01:23:38 +03:00
/**
* @brief from cast to chrono secunds
* @param mcrs microseconds of uint_64
* @return microseconds of chrono
*/
static Clock from(const milliseconds &mcrs);
/**
* @brief abs
* @return module of numver
*/
static milliseconds abs(milliseconds number);
};
#endif // CHRONOTIME_H