ifw-fgf 1.0.0-pre1
Loading...
Searching...
No Matches
defines.hpp
Go to the documentation of this file.
1
6#ifndef FGF_LIB_DEFINES_HPP_H_
7#define FGF_LIB_DEFINES_HPP_H_
8
9#include <cstdint>
10#include <thread>
11#include <fmt/format.h>
12
13namespace ifw::fgf::common {
14
18 inline double Time() {
19 std::chrono::time_point<std::chrono::system_clock> now = std::chrono::system_clock::now();
20 auto duration = now.time_since_epoch();
21 auto time_now_ns = std::chrono::duration_cast<std::chrono::nanoseconds>(duration).count();
22 return (time_now_ns / 1e9);
23 }
24
28 inline void Sleep(const float sleep_time) {
29 std::chrono::duration<double> chrono_sleep_time(sleep_time);
30 std::this_thread::sleep_for(chrono_sleep_time);
31 }
32
33}
34
35#endif // FGF_LIB_DEFINES_HPP_H_
Frame Grabber Camera Base Class definitions.
Definition binarySemaphore.hpp:43
void Sleep(const float sleep_time)
Make the calling thread sleep for the given period of time given as seconds.
Definition defines.hpp:28
double Time()
Return time as seconds since epoch with micro second precision.
Definition defines.hpp:18