21 now = ACE_OS::gettimeofday();
23 struct timezone *tz =
nullptr;
24 gettimeofday(&
now, tz);
31 now.tv_sec = lround(
t);
32 now.tv_usec = lround((
t-
now.tv_sec)*1e6);
40 std::this_thread::sleep_for(std::chrono::duration<double>(
toDouble(sleep_period)));
51 val.tv_usec += add.tv_usec;
52 int over = val.tv_usec % 1000000;
53 if (over != val.tv_usec) {
57 val.tv_sec += add.tv_sec;
66 if (val.tv_usec > subtract.tv_usec) {
67 val.tv_usec -= subtract.tv_usec;
68 val.tv_sec -= subtract.tv_sec;
71 int over = 1000000 + val.tv_usec - subtract.tv_usec;
74 val.tv_sec -= subtract.tv_sec;
81 return double(v.sec()) + v.usec() * 1e-6;
83 return double(v.tv_sec) + v.tv_usec * 1e-6;
90 v.msec(lround(x*1000/unit+0.5));
92 v.tv_usec = lround(x*1000000/unit+0.5) % 1000000;
93 v.tv_sec = lround(x/unit);