-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.
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)
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)
NtQueryInformationProcess (NtCurrentProcess (), ProcessTimes,
&kut, sizeof kut, NULL);
- GetSystemTimeAsFileTime ((LPFILETIME) &ticks);
+ get_system_time (&ticks);
/* uptime */
ticks.QuadPart -= stodi.BootTime.QuadPart;
{
LARGE_INTEGER systime;
- GetSystemTimeAsFileTime ((LPFILETIME) &systime);
+ get_system_time (&systime);
to_timestruc_t (&systime, out);
}
time_t res;
LARGE_INTEGER systime;
- GetSystemTimeAsFileTime ((LPFILETIME) &systime);
+ get_system_time (&systime);
res = to_time_t (&systime);
if (ptr)
*ptr = res;
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;
}
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)) = {
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)) = {
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)) = {
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)) = {
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));
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
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
};