]> sourceware.org Git - newlib-cygwin.git/commitdiff
* autoload.cc (GetSystemTimePreciseAsFileTime): Define.
authorCorinna Vinschen <corinna@vinschen.de>
Fri, 14 Jun 2013 15:41:17 +0000 (15:41 +0000)
committerCorinna Vinschen <corinna@vinschen.de>
Fri, 14 Jun 2013 15:41:17 +0000 (15:41 +0000)
* 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.

winsup/cygwin/ChangeLog
winsup/cygwin/autoload.cc
winsup/cygwin/times.cc
winsup/cygwin/wincap.cc
winsup/cygwin/wincap.h

index 842c6a228c9646ecb0d4f28915e2ebf6df22512e..386d54c423e9b6fecfc136d9287878059dd6ee63 100644 (file)
@@ -1,4 +1,15 @@
-2013-06-13  Corinna Vinschen  <corinna@vinschen.de>
+2013-06-14  Corinna Vinschen  <corinna@vinschen.de>
+
+       * 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.
+
+2013-06-14  Corinna Vinschen  <corinna@vinschen.de>
 
        Streamline time/times functionality.  Remove last remains of former
        Windows 9x compatibility.
index 75771a2b6dbe3d25330e3ae189d9c31995df8c25..ed80802582a0958292114936d5dfc5d5cad79538 100644 (file)
@@ -577,6 +577,7 @@ LoadDLLfunc (GetUdpTable, 12, iphlpapi)
 LoadDLLfuncEx (CancelSynchronousIo, 4, kernel32, 1)
 LoadDLLfunc (CreateSymbolicLinkW, 12, kernel32)
 LoadDLLfuncEx (GetNamedPipeClientProcessId, 8, kernel32, 1)
+LoadDLLfunc (GetSystemTimePreciseAsFileTime, 4, kernel32)
 LoadDLLfunc (LocaleNameToLCID, 8, kernel32)
 
 LoadDLLfunc (WNetCloseEnum, 4, mpr)
index 749c7cdea7846ae3d7e33293dfbea91adbc3830f..ac0f4e1557e94d9ba8a05f99e95c4a0ad3c5f50d 100644 (file)
@@ -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;
 }
index 9964467e359b64d256e85817b4047792a5dd498d..d84679df55197b2499918c6e0ae8d909938776d7 100644 (file)
@@ -48,6 +48,7 @@ wincaps wincap_xpsp2 __attribute__((section (".cygwin_dll_common"), shared)) = {
   has_program_compatibility_assistant:false,
   has_pipe_reject_remote_clients:false,
   terminate_thread_frees_stack:false,
+  has_precise_system_time:false,
 };
 
 wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -75,6 +76,7 @@ wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = {
   has_program_compatibility_assistant:false,
   has_pipe_reject_remote_clients:false,
   terminate_thread_frees_stack:false,
+  has_precise_system_time:false,
 };
 
 wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -102,6 +104,7 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
   has_program_compatibility_assistant:true,
   has_pipe_reject_remote_clients:true,
   terminate_thread_frees_stack:true,
+  has_precise_system_time:false,
 };
 
 wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -129,6 +132,7 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
   has_program_compatibility_assistant:true,
   has_pipe_reject_remote_clients:true,
   terminate_thread_frees_stack:true,
+  has_precise_system_time:false,
 };
 
 wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -156,6 +160,7 @@ wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = {
   has_program_compatibility_assistant:true,
   has_pipe_reject_remote_clients:true,
   terminate_thread_frees_stack:true,
+  has_precise_system_time:true,
 };
 
 wincapc wincap __attribute__((section (".cygwin_dll_common"), shared));
index 1004a5e469cf1ca581959f625da2e2be93ce8678..cf42dc90ef07a5043d6c9be8ce293e0118e02172 100644 (file)
@@ -38,6 +38,7 @@ struct wincaps
   unsigned has_program_compatibility_assistant         : 1;
   unsigned has_pipe_reject_remote_clients              : 1;
   unsigned terminate_thread_frees_stack                        : 1;
+  unsigned has_precise_system_time                     : 1;
 };
 
 class wincapc
@@ -87,6 +88,7 @@ public:
   bool IMPLEMENT (has_program_compatibility_assistant)
   bool IMPLEMENT (has_pipe_reject_remote_clients)
   bool IMPLEMENT (terminate_thread_frees_stack)
+  bool IMPLEMENT (has_precise_system_time)
 
 #undef IMPLEMENT
 };
This page took 0.038973 seconds and 5 git commands to generate.