posix/coil/Time.h
Go to the documentation of this file.
1 // -*- C++ -*-
19 #ifndef COIL_TIME_H
20 #define COIL_TIME_H
21 
22 #include <unistd.h>
23 #include <sys/time.h>
24 #include <sys/types.h>
25 #include <time.h>
26 #include <iostream>
27 #include <coil/config_coil.h>
28 #include <coil/TimeValue.h>
29 
30 namespace coil
31 {
32 
54  inline unsigned int sleep(unsigned int seconds)
55  {
56  return ::sleep(seconds);
57  }
58 
80  inline int sleep(TimeValue interval)
81  {
82  timeval tv;
83  tv.tv_sec = interval.sec();
84  tv.tv_usec = interval.usec();
85  return ::select(0, 0, 0, 0, &tv);
86  }
87 
109  inline int usleep(useconds_t usec)
110  {
111  return ::usleep(usec);
112  }
113 
137  inline int gettimeofday(struct timeval *tv, struct timezone *tz)
138  {
139  return ::gettimeofday(tv, tz);
140  }
141 
159  inline TimeValue gettimeofday()
160  {
161  timeval tv;
162  ::gettimeofday(&tv, 0);
163  return TimeValue(tv.tv_sec, tv.tv_usec);
164  }
165 
189  inline int settimeofday(const struct timeval *tv , const struct timezone *tz)
190  {
191  return ::settimeofday(tv, tz);
192  }
193 
194 
195 };
196 
197 #endif // COIL_TIME_H
long int sec() const
Get value of second time scale.
Definition: TimeValue.h:110
unsigned int sleep(unsigned int seconds)
Stop a processing at specified second time.
Definition: ace/coil/Time.h:40
int gettimeofday(struct timeval *tv, struct timezone *tz)
Get the time and timezone.
Definition: ace/coil/Time.h:57
int sleep(TimeValue interval)
Stop a processing at specified second time.
int settimeofday(const struct timeval *tv, const struct timezone *tz)
Set the time and timezone.
Definition: ace/coil/Time.h:75
long int usec() const
Get value of micro second time scale.
Definition: TimeValue.h:131
int usleep(useconds_t usec)
Stop a processing at specified micro second time.
Definition: ace/coil/Time.h:51
Common Object Interface Layer.


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Thu Jun 6 2019 19:26:00