Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2013-06-14 19:41:17 +0400
committerCorinna Vinschen <corinna@vinschen.de>2013-06-14 19:41:17 +0400
commit7584fa98d40958abe6d657e9c5707e962aaf794c (patch)
treed1b42ffcb5de43bcf662979ea85c618959459882 /winsup/cygwin/times.cc
parent0ff057d5a5f811d13cbab893d61bade826eaf223 (diff)
* autoload.cc (GetSystemTimePreciseAsFileTime): Define.
* times.cc (GetSystemTimePreciseAsFileTime): Temporarily declare here to workaround missing definition in 32 bit w32api headers. (get_system_time): New always inline function to call either GetSystemTimePreciseAsFileTime or GetSystemTimeAsFileTime on a per OS basis. Call throughout instead of GetSystemTimeAsFileTime. * wincap.h (wincaps::has_precise_system_time): New element. * wincap.cc: Implement above element throughout.
Diffstat (limited to 'winsup/cygwin/times.cc')
-rw-r--r--winsup/cygwin/times.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc
index 749c7cdea..ac0f4e155 100644
--- a/winsup/cygwin/times.cc
+++ b/winsup/cygwin/times.cc
@@ -31,6 +31,16 @@ hires_ms NO_COPY gtod;
hires_ns NO_COPY ntod;
+extern "C" { void WINAPI GetSystemTimePreciseAsFileTime (LPFILETIME); }
+
+static inline void __attribute__ ((always_inline))
+get_system_time (PLARGE_INTEGER systime)
+{
+ wincap.has_precise_system_time ()
+ ? GetSystemTimePreciseAsFileTime ((LPFILETIME) systime)
+ : GetSystemTimeAsFileTime ((LPFILETIME) systime);
+}
+
/* Cygwin internal */
static uint64_t __stdcall
__to_clock_t (PLARGE_INTEGER src, int flag)
@@ -64,7 +74,7 @@ times (struct tms *buf)
NtQueryInformationProcess (NtCurrentProcess (), ProcessTimes,
&kut, sizeof kut, NULL);
- GetSystemTimeAsFileTime ((LPFILETIME) &ticks);
+ get_system_time (&ticks);
/* uptime */
ticks.QuadPart -= stodi.BootTime.QuadPart;
@@ -286,7 +296,7 @@ time_as_timestruc_t (timestruc_t * out)
{
LARGE_INTEGER systime;
- GetSystemTimeAsFileTime ((LPFILETIME) &systime);
+ get_system_time (&systime);
to_timestruc_t (&systime, out);
}
@@ -298,7 +308,7 @@ time (time_t * ptr)
time_t res;
LARGE_INTEGER systime;
- GetSystemTimeAsFileTime ((LPFILETIME) &systime);
+ get_system_time (&systime);
res = to_time_t (&systime);
if (ptr)
*ptr = res;
@@ -486,7 +496,7 @@ LONGLONG
hires_ms::nsecs ()
{
LARGE_INTEGER systime;
- GetSystemTimeAsFileTime ((LPFILETIME) &systime);
+ get_system_time (&systime);
/* Add conversion factor for UNIX vs. Windows base time */
return systime.QuadPart - FACTOR;
}