34#define USECS_PER_SEC 1000000
35#define NANOSECS_PER_SEC 1000000000
50 return IceUtil::Time::now();
82 if (duration.toMicroSeconds() <= 0)
95 USleep(duration.toMicroSeconds());
102 Sleep(IceUtil::Time::milliSeconds(durationMS));
170 return nanosleep(&ts,
nullptr);
176 return time.toString(
"%Y-%m-%d");
182 return time.toString(
"%H-%M-%S");
188 return time.toString(
"%Y-%m-%d_%H-%M-%S");
Used by CallbackWaitLock.
CallbackWaitLock is used to block a thread and unblock it from another thread via callback.
void wait()
wait blocks the calling thread until CallbackWaitLock::call() is called.
static LocalTimeServerPtr GetTimeServer()
static IceUtil::Time GetTime(TimeMode timeMode=TimeMode::VirtualTime)
Get the current time.
static void SetTimeServer(LocalTimeServerPtr ts)
static std::string toStringDate(const IceUtil::Time &time)
Return a date string like "2020-01-31" (Y-M-D).
static IceUtil::Time GetTimeSince(IceUtil::Time referenceTime, TimeMode timeMode=TimeMode::VirtualTime)
Get the difference between the current time and a reference time.
static std::string toStringTime(const IceUtil::Time &time)
Return a time string like "15-30-05" (H-M-S).
static void WaitForNextTick()
block until the next tick of the timeserver.
static std::string toStringDateTime(const IceUtil::Time &time)
Return a date & time string like "2020-01-31_15-30-05" (Y-M-D_H-M-S).
static void MSSleep(int durationMS)
lock the calling thread for a given duration (like usleep(...) but using Timeserver time)
static int NanoSleep(long usec)
Nanosleep convenience function.
static LocalTimeServerPtr timeServerPtr
pointer to the applications LocalTimeServer if NULL, system time is used
static int USleep(long usec)
like timed_wait on boost condition_variables, but with timeserver support
static void Sleep(IceUtil::Time duration)
lock the calling thread for a given duration (like usleep(...) but using Timeserver time)
static bool HasTimeServer()
check if we have been initialized with a Timeserver
TimeMode
Time mode to be used.
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< LocalTimeServer > LocalTimeServerPtr