ifw-core  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
time.hpp
Go to the documentation of this file.
1 
9 #ifndef IFW_CTD_TIME_HPP_
10 #define IFW_CTD_TIME_HPP_
11 
12 #include <string>
13 #include <sys/sem.h>
14 #include <pthread.h>
15 #include <mutex>
16 
17 #include "rad/logger.hpp"
18 
19 #include "ctd/defines/defines.hpp"
20 
21 
22 namespace ctd::time {
23 
28  void Sleep(const float sleep_time);
29 
31  double Time();
32 
34  void SecondsToTimeSpec(const double time,
35  struct timespec& time_spec);
36 
38  void SecondsToTimeVal(const double time,
39  struct timeval& time_val);
40 
42  std::string IsoTime(const double time_since_epoch,
43  const uint8_t prec = 6);
44 
46  std::string IsoTimeNow(const int8_t prec = 6);
47 
48 }
49 
50 #endif // IFW_CTD_TIME_HPP_
void SecondsToTimeVal(const double time, struct timeval &time_val)
Convert time in seconds since epoch to timeval struct.
Definition: time.cpp:38
Common definitions.
std::string IsoTimeNow(const int8_t prec=6)
Generate ISO8601 timestamp from time of invoking this function.
Definition: time.cpp:72
void Sleep(const float sleep_time)
Sleep.
Definition: time.cpp:14
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:47
void SecondsToTimeSpec(const double time, struct timespec &time_spec)
Convert time in seconds since epoch to a timespec struct.
Definition: time.cpp:29
double Time()
Return the time in seconds since epoch.
Definition: time.cpp:22