ifw-core  5.0.0-pre2
time.hpp
Go to the documentation of this file.
1 
6 #ifndef IFW_CORE_UTILS_TIME_HPP_
7 #define IFW_CORE_UTILS_TIME_HPP_
8 
9 #include <string>
10 #include <sys/sem.h>
11 #include <pthread.h>
12 #include <mutex>
13 
14 #include <rad/logger.hpp>
15 
16 #include <core/utils/base/base.hpp>
17 
18 namespace core::utils::time {
19 
23  void Sleep(const float sleep_time);
24 
26  double Time();
27 
29  void SecondsToTimeSpec(const double time,
30  struct timespec& time_spec);
31 
33  void SecondsToTimeVal(const double time,
34  struct timeval& time_val);
35 
37  std::string IsoTime(const double time_since_epoch,
38  const uint8_t prec = 6);
39 
41  std::string IsoTimeNow(const int8_t prec = 6);
42 
43 }
44 
45 #endif // IFW_CORE_UTILS_TIME_HPP_
Definition: time.hpp:18
std::string IsoTime(const double time_since_epoch, const uint8_t prec=6)
Generate ISO8601 timestamp from provided time in seconds since epoch.
Definition: time.cpp:39
std::string IsoTimeNow(const int8_t prec=6)
Generate ISO8601 timestamp from time of invoking this function.
Definition: time.cpp:62
void SecondsToTimeSpec(const double time, struct timespec &time_spec)
Convert time in seconds since epoch to a timespec struct.
Definition: time.cpp:25
void Sleep(const float sleep_time)
Sleep.
Definition: time.cpp:14
double Time()
Return the time in seconds since epoch.
Definition: time.cpp:20
void SecondsToTimeVal(const double time, struct timeval &time_val)
Convert time in seconds since epoch to timeval struct.
Definition: time.cpp:32