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
path: root/winsup
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
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')
-rw-r--r--winsup/cygwin/ChangeLog13
-rw-r--r--winsup/cygwin/autoload.cc1
-rw-r--r--winsup/cygwin/times.cc18
-rw-r--r--winsup/cygwin/wincap.cc5
-rw-r--r--winsup/cygwin/wincap.h2
5 files changed, 34 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 842c6a228..386d54c42 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -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.
diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc
index 75771a2b6..ed8080258 100644
--- a/winsup/cygwin/autoload.cc
+++ b/winsup/cygwin/autoload.cc
@@ -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)
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;
}
diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc
index 9964467e3..d84679df5 100644
--- a/winsup/cygwin/wincap.cc
+++ b/winsup/cygwin/wincap.cc
@@ -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));
diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h
index 1004a5e46..cf42dc90e 100644
--- a/winsup/cygwin/wincap.h
+++ b/winsup/cygwin/wincap.h
@@ -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
};