summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2019-01-12 20:23:55 +0100
committerCorinna Vinschen <corinna@vinschen.de>2019-01-12 21:20:37 +0100
commit961be8d726a81918d8d34c9dae603e7820a2416f (patch)
treec0c40a1e1b35b0c1074e02874f5bda997ebd2a2e
parent92cbaa9f2365da2f94ac54819b9035fe13198400 (diff)
downloadcygnal-961be8d726a81918d8d34c9dae603e7820a2416f.tar.gz
cygnal-961be8d726a81918d8d34c9dae603e7820a2416f.tar.bz2
cygnal-961be8d726a81918d8d34c9dae603e7820a2416f.zip
Cygwin: posix timers: some cleanup
- use int64_t instead of long long - make is_timer_tracker const - improve copyright header comment Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r--winsup/cygwin/timer.cc16
-rw-r--r--winsup/cygwin/timer.h8
2 files changed, 12 insertions, 12 deletions
diff --git a/winsup/cygwin/timer.cc b/winsup/cygwin/timer.cc
index 802aa444a..0aeba5830 100644
--- a/winsup/cygwin/timer.cc
+++ b/winsup/cygwin/timer.cc
@@ -1,4 +1,4 @@
-/* timer.cc
+/* timer.cc: posix timers
This file is part of Cygwin.
@@ -87,10 +87,10 @@ timer_tracker::timer_tracker (clockid_t c, const sigevent *e)
}
}
-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;
@@ -99,11 +99,11 @@ timespec_to_us (const timespec& ts)
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 */
@@ -260,8 +260,8 @@ timer_tracker::gettime (itimerspec *ovalue)
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;
diff --git a/winsup/cygwin/timer.h b/winsup/cygwin/timer.h
index 4a961fcb0..0442c37d1 100644
--- a/winsup/cygwin/timer.h
+++ b/winsup/cygwin/timer.h
@@ -1,4 +1,4 @@
-/* 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.
@@ -20,15 +20,15 @@ class timer_tracker
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 *);