From: Christopher Faylor Date: Sat, 11 Feb 2006 00:06:50 +0000 (+0000) Subject: * times.cc (clock_getres): Use correct conversion from milliseconds to X-Git-Tag: gdb-csl-20060226-branchpoint~41 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=7f8c7bff6f026e405860c92359d979736e00fca6;p=newlib-cygwin.git * times.cc (clock_getres): Use correct conversion from milliseconds to seconds/nanoseconds. (clock_setres): Use correct conversion to nanoseconds. --- diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 824de565e..71ad36626 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2006-02-10 Brian Ford + + * times.cc (clock_getres): Use correct conversion from milliseconds to + seconds/nanoseconds. + (clock_setres): Use correct conversion to nanoseconds. + 2006-02-10 Christopher Faylor * external.cc (sync_winenv): Rename from "setup_winenv". Use same diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index c71299ff0..20db4e133 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -61,7 +61,7 @@ set_myself (HANDLE h) /* here if execed */ static pinfo NO_COPY myself_identity; myself_identity.init (cygwin_pid (myself->dwProcessId), PID_EXECED, NULL); - myself->start_time = time (NULL); /* Register our starting time. */ + // myself->start_time = time (NULL); /* Register our starting time. */ myself->exec_sendsig = NULL; myself->exec_dwProcessId = 0; } diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc index ba387bfd6..3922caf31 100644 --- a/winsup/cygwin/times.cc +++ b/winsup/cygwin/times.cc @@ -711,8 +711,8 @@ clock_getres (clockid_t clk_id, struct timespec *tp) DWORD period = gtod.resolution (); - tp->tv_sec = period / 1000000; - tp->tv_nsec = (period % 1000000) * 1000; + tp->tv_sec = period / 1000; + tp->tv_nsec = (period % 1000) * 1000000; return 0; } @@ -730,7 +730,7 @@ clock_setres (clockid_t clk_id, struct timespec *tp) if (period_set) timeEndPeriod (minperiod); - DWORD period = (tp->tv_sec * 1000) + ((tp->tv_nsec) / 1000); + DWORD period = (tp->tv_sec * 1000) + ((tp->tv_nsec) / 1000000); if (timeBeginPeriod (period)) {