mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-31 03:20:28 +08:00
* 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.
This commit is contained in:
parent
0ff057d5a5
commit
7584fa98d4
@ -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
|
Streamline time/times functionality. Remove last remains of former
|
||||||
Windows 9x compatibility.
|
Windows 9x compatibility.
|
||||||
|
@ -577,6 +577,7 @@ LoadDLLfunc (GetUdpTable, 12, iphlpapi)
|
|||||||
LoadDLLfuncEx (CancelSynchronousIo, 4, kernel32, 1)
|
LoadDLLfuncEx (CancelSynchronousIo, 4, kernel32, 1)
|
||||||
LoadDLLfunc (CreateSymbolicLinkW, 12, kernel32)
|
LoadDLLfunc (CreateSymbolicLinkW, 12, kernel32)
|
||||||
LoadDLLfuncEx (GetNamedPipeClientProcessId, 8, kernel32, 1)
|
LoadDLLfuncEx (GetNamedPipeClientProcessId, 8, kernel32, 1)
|
||||||
|
LoadDLLfunc (GetSystemTimePreciseAsFileTime, 4, kernel32)
|
||||||
LoadDLLfunc (LocaleNameToLCID, 8, kernel32)
|
LoadDLLfunc (LocaleNameToLCID, 8, kernel32)
|
||||||
|
|
||||||
LoadDLLfunc (WNetCloseEnum, 4, mpr)
|
LoadDLLfunc (WNetCloseEnum, 4, mpr)
|
||||||
|
@ -31,6 +31,16 @@ hires_ms NO_COPY gtod;
|
|||||||
|
|
||||||
hires_ns NO_COPY ntod;
|
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 */
|
/* Cygwin internal */
|
||||||
static uint64_t __stdcall
|
static uint64_t __stdcall
|
||||||
__to_clock_t (PLARGE_INTEGER src, int flag)
|
__to_clock_t (PLARGE_INTEGER src, int flag)
|
||||||
@ -64,7 +74,7 @@ times (struct tms *buf)
|
|||||||
|
|
||||||
NtQueryInformationProcess (NtCurrentProcess (), ProcessTimes,
|
NtQueryInformationProcess (NtCurrentProcess (), ProcessTimes,
|
||||||
&kut, sizeof kut, NULL);
|
&kut, sizeof kut, NULL);
|
||||||
GetSystemTimeAsFileTime ((LPFILETIME) &ticks);
|
get_system_time (&ticks);
|
||||||
|
|
||||||
/* uptime */
|
/* uptime */
|
||||||
ticks.QuadPart -= stodi.BootTime.QuadPart;
|
ticks.QuadPart -= stodi.BootTime.QuadPart;
|
||||||
@ -286,7 +296,7 @@ time_as_timestruc_t (timestruc_t * out)
|
|||||||
{
|
{
|
||||||
LARGE_INTEGER systime;
|
LARGE_INTEGER systime;
|
||||||
|
|
||||||
GetSystemTimeAsFileTime ((LPFILETIME) &systime);
|
get_system_time (&systime);
|
||||||
to_timestruc_t (&systime, out);
|
to_timestruc_t (&systime, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,7 +308,7 @@ time (time_t * ptr)
|
|||||||
time_t res;
|
time_t res;
|
||||||
LARGE_INTEGER systime;
|
LARGE_INTEGER systime;
|
||||||
|
|
||||||
GetSystemTimeAsFileTime ((LPFILETIME) &systime);
|
get_system_time (&systime);
|
||||||
res = to_time_t (&systime);
|
res = to_time_t (&systime);
|
||||||
if (ptr)
|
if (ptr)
|
||||||
*ptr = res;
|
*ptr = res;
|
||||||
@ -486,7 +496,7 @@ LONGLONG
|
|||||||
hires_ms::nsecs ()
|
hires_ms::nsecs ()
|
||||||
{
|
{
|
||||||
LARGE_INTEGER systime;
|
LARGE_INTEGER systime;
|
||||||
GetSystemTimeAsFileTime ((LPFILETIME) &systime);
|
get_system_time (&systime);
|
||||||
/* Add conversion factor for UNIX vs. Windows base time */
|
/* Add conversion factor for UNIX vs. Windows base time */
|
||||||
return systime.QuadPart - FACTOR;
|
return systime.QuadPart - FACTOR;
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ wincaps wincap_xpsp2 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
|||||||
has_program_compatibility_assistant:false,
|
has_program_compatibility_assistant:false,
|
||||||
has_pipe_reject_remote_clients:false,
|
has_pipe_reject_remote_clients:false,
|
||||||
terminate_thread_frees_stack:false,
|
terminate_thread_frees_stack:false,
|
||||||
|
has_precise_system_time:false,
|
||||||
};
|
};
|
||||||
|
|
||||||
wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
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_program_compatibility_assistant:false,
|
||||||
has_pipe_reject_remote_clients:false,
|
has_pipe_reject_remote_clients:false,
|
||||||
terminate_thread_frees_stack:false,
|
terminate_thread_frees_stack:false,
|
||||||
|
has_precise_system_time:false,
|
||||||
};
|
};
|
||||||
|
|
||||||
wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
|
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_program_compatibility_assistant:true,
|
||||||
has_pipe_reject_remote_clients:true,
|
has_pipe_reject_remote_clients:true,
|
||||||
terminate_thread_frees_stack:true,
|
terminate_thread_frees_stack:true,
|
||||||
|
has_precise_system_time:false,
|
||||||
};
|
};
|
||||||
|
|
||||||
wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
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_program_compatibility_assistant:true,
|
||||||
has_pipe_reject_remote_clients:true,
|
has_pipe_reject_remote_clients:true,
|
||||||
terminate_thread_frees_stack:true,
|
terminate_thread_frees_stack:true,
|
||||||
|
has_precise_system_time:false,
|
||||||
};
|
};
|
||||||
|
|
||||||
wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
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_program_compatibility_assistant:true,
|
||||||
has_pipe_reject_remote_clients:true,
|
has_pipe_reject_remote_clients:true,
|
||||||
terminate_thread_frees_stack:true,
|
terminate_thread_frees_stack:true,
|
||||||
|
has_precise_system_time:true,
|
||||||
};
|
};
|
||||||
|
|
||||||
wincapc wincap __attribute__((section (".cygwin_dll_common"), shared));
|
wincapc wincap __attribute__((section (".cygwin_dll_common"), shared));
|
||||||
|
@ -38,6 +38,7 @@ struct wincaps
|
|||||||
unsigned has_program_compatibility_assistant : 1;
|
unsigned has_program_compatibility_assistant : 1;
|
||||||
unsigned has_pipe_reject_remote_clients : 1;
|
unsigned has_pipe_reject_remote_clients : 1;
|
||||||
unsigned terminate_thread_frees_stack : 1;
|
unsigned terminate_thread_frees_stack : 1;
|
||||||
|
unsigned has_precise_system_time : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
class wincapc
|
class wincapc
|
||||||
@ -87,6 +88,7 @@ public:
|
|||||||
bool IMPLEMENT (has_program_compatibility_assistant)
|
bool IMPLEMENT (has_program_compatibility_assistant)
|
||||||
bool IMPLEMENT (has_pipe_reject_remote_clients)
|
bool IMPLEMENT (has_pipe_reject_remote_clients)
|
||||||
bool IMPLEMENT (terminate_thread_frees_stack)
|
bool IMPLEMENT (terminate_thread_frees_stack)
|
||||||
|
bool IMPLEMENT (has_precise_system_time)
|
||||||
|
|
||||||
#undef IMPLEMENT
|
#undef IMPLEMENT
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user