-/* timer.cc
+/* timer.cc: posix timers
This file is part of Cygwin.
}
}
-static inline long long
+static inline int64_t
timespec_to_us (const timespec& ts)
{
- long long res = ts.tv_sec;
+ int64_t res = ts.tv_sec;
res *= USPERSEC;
res += (ts.tv_nsec + (NSPERSEC/USPERSEC) - 1) / (NSPERSEC/USPERSEC);
return res;
DWORD
timer_tracker::thread_func ()
{
- long long now;
- long long cur_sleepto_us = sleepto_us;
+ int64_t now;
+ int64_t cur_sleepto_us = sleepto_us;
while (1)
{
- long long sleep_us;
+ int64_t sleep_us;
LONG sleep_ms;
/* Account for delays in starting thread
and sending the signal */
else
{
ovalue->it_interval = it_interval;
- long long now = get_clock (clock_id)->usecs ();
- long long left_us = sleepto_us - now;
+ int64_t now = get_clock (clock_id)->usecs ();
+ int64_t left_us = sleepto_us - now;
if (left_us < 0)
left_us = 0;
ovalue->it_value.tv_sec = left_us / USPERSEC;
-/* timer.h: Define class timer_tracker, base class for timer handling
+/* timer.h: Define class timer_tracker, base class for posix timers
This file is part of Cygwin.
timespec it_interval;
HANDLE hcancel;
HANDLE syncthread;
- long long interval_us;
- long long sleepto_us;
+ int64_t interval_us;
+ int64_t sleepto_us;
bool cancel ();
public:
timer_tracker (clockid_t, const sigevent *);
~timer_tracker ();
- inline bool is_timer_tracker () { return magic == TT_MAGIC; }
+ inline bool is_timer_tracker () const { return magic == TT_MAGIC; }
void gettime (itimerspec *);
int settime (int, const itimerspec *, itimerspec *);