[newlib-cygwin] Cygwin: drop wincap::has_precise_system_time

Corinna Vinschen corinna@sourceware.org
Sun Dec 4 13:27:22 GMT 2022


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=70d77662f5742718eb37dbd9e373fe7ab12b8c36

commit 70d77662f5742718eb37dbd9e373fe7ab12b8c36
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Tue Nov 15 17:13:28 2022 +0100
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Sun Dec 4 14:01:41 2022 +0100

    Cygwin: drop wincap::has_precise_system_time
    
    Only required for Windows 7.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/clock.cc                | 18 ++++--------------
 winsup/cygwin/local_includes/wincap.h |  2 --
 winsup/cygwin/times.cc                |  4 +---
 winsup/cygwin/wincap.cc               | 12 ------------
 4 files changed, 5 insertions(+), 31 deletions(-)

diff --git a/winsup/cygwin/clock.cc b/winsup/cygwin/clock.cc
index 0c0bd9994e3e..1c675f0f26c8 100644
--- a/winsup/cygwin/clock.cc
+++ b/winsup/cygwin/clock.cc
@@ -40,13 +40,8 @@ clk_t::init ()
 void inline
 clk_realtime_t::init ()
 {
-  if (wincap.has_precise_system_time ())
-    {
-      if (!ticks_per_sec)
-	InterlockedExchange64 (&ticks_per_sec, system_qpc_tickspersec ());
-    }
-  else if (!period)
-    InterlockedExchange64 (&period, system_tickcount_period ());
+  if (!ticks_per_sec)
+    InterlockedExchange64 (&ticks_per_sec, system_qpc_tickspersec ());
 }
 
 void inline
@@ -74,9 +69,7 @@ clk_realtime_t::now (clockid_t clockid, struct timespec *ts)
 {
   LARGE_INTEGER now;
 
-  wincap.has_precise_system_time ()
-      ? GetSystemTimePreciseAsFileTime ((LPFILETIME) &now)
-      : GetSystemTimeAsFileTime ((LPFILETIME) &now);
+  GetSystemTimePreciseAsFileTime ((LPFILETIME) &now);
   /* Add conversion factor for UNIX vs. Windows base time */
   now.QuadPart -= FACTOR;
   ts->tv_sec = now.QuadPart / NS100PERSEC;
@@ -236,10 +229,7 @@ clk_realtime_t::resolution (struct timespec *ts)
 {
   init ();
   ts->tv_sec = 0;
-  if (wincap.has_precise_system_time ())
-    ts->tv_nsec = NSPERSEC / ticks_per_sec;
-  else
-    ts->tv_nsec = period * (NSPERSEC/NS100PERSEC);
+  ts->tv_nsec = NSPERSEC / ticks_per_sec;
 }
 
 void
diff --git a/winsup/cygwin/local_includes/wincap.h b/winsup/cygwin/local_includes/wincap.h
index 1075f3bea85e..0a2ad7b59159 100644
--- a/winsup/cygwin/local_includes/wincap.h
+++ b/winsup/cygwin/local_includes/wincap.h
@@ -17,7 +17,6 @@ struct wincaps
      ops generated by gcc are off by 4 bytes. */
   struct  __attribute__ ((aligned (8))) {
     unsigned is_server						: 1;
-    unsigned has_precise_system_time				: 1;
     unsigned has_microsoft_accounts				: 1;
     unsigned has_new_pebteb_region				: 1;
     unsigned has_broken_whoami					: 1;
@@ -75,7 +74,6 @@ public:
   }
   intptr_t IMPLEMENT (mmap_storage_high)
   bool  IMPLEMENT (is_server)
-  bool	IMPLEMENT (has_precise_system_time)
   bool	IMPLEMENT (has_microsoft_accounts)
   bool	IMPLEMENT (has_new_pebteb_region)
   bool	IMPLEMENT (has_broken_whoami)
diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc
index 4ab432925e56..ddea061b8920 100644
--- a/winsup/cygwin/times.cc
+++ b/winsup/cygwin/times.cc
@@ -29,9 +29,7 @@ details. */
 static inline void __attribute__ ((always_inline))
 get_system_time (PLARGE_INTEGER systime)
 {
-  wincap.has_precise_system_time ()
-	? GetSystemTimePreciseAsFileTime ((LPFILETIME) systime)
-	: GetSystemTimeAsFileTime ((LPFILETIME) systime);
+  GetSystemTimePreciseAsFileTime ((LPFILETIME) systime);
 }
 
 /* Cygwin internal */
diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc
index 15400d8d0f57..7ee8f4b06ea8 100644
--- a/winsup/cygwin/wincap.cc
+++ b/winsup/cygwin/wincap.cc
@@ -24,7 +24,6 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
   mmap_storage_high:__MMAP_STORAGE_HIGH_LEGACY,
   {
     is_server:false,
-    has_precise_system_time:false,
     has_microsoft_accounts:false,
     has_new_pebteb_region:false,
     has_broken_whoami:true,
@@ -54,7 +53,6 @@ wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = {
   mmap_storage_high:__MMAP_STORAGE_HIGH_LEGACY,
   {
     is_server:false,
-    has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:false,
     has_broken_whoami:false,
@@ -84,7 +82,6 @@ wincaps wincap_8_1 __attribute__((section (".cygwin_dll_common"), shared)) = {
   mmap_storage_high:__MMAP_STORAGE_HIGH,
   {
     is_server:false,
-    has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:false,
     has_broken_whoami:false,
@@ -114,7 +111,6 @@ wincaps  wincap_10_1507 __attribute__((section (".cygwin_dll_common"), shared))
   mmap_storage_high:__MMAP_STORAGE_HIGH,
   {
     is_server:false,
-    has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:false,
     has_broken_whoami:false,
@@ -144,7 +140,6 @@ wincaps  wincap_10_1607 __attribute__((section (".cygwin_dll_common"), shared))
   mmap_storage_high:__MMAP_STORAGE_HIGH,
   {
     is_server:false,
-    has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:false,
     has_broken_whoami:false,
@@ -174,7 +169,6 @@ wincaps wincap_10_1703 __attribute__((section (".cygwin_dll_common"), shared)) =
   mmap_storage_high:__MMAP_STORAGE_HIGH,
   {
     is_server:false,
-    has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:true,
     has_broken_whoami:false,
@@ -204,7 +198,6 @@ wincaps wincap_10_1709 __attribute__((section (".cygwin_dll_common"), shared)) =
   mmap_storage_high:__MMAP_STORAGE_HIGH,
   {
     is_server:false,
-    has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:true,
     has_broken_whoami:false,
@@ -234,7 +227,6 @@ wincaps wincap_10_1803 __attribute__((section (".cygwin_dll_common"), shared)) =
   mmap_storage_high:__MMAP_STORAGE_HIGH,
   {
     is_server:false,
-    has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:true,
     has_broken_whoami:false,
@@ -264,7 +256,6 @@ wincaps wincap_10_1809 __attribute__((section (".cygwin_dll_common"), shared)) =
   mmap_storage_high:__MMAP_STORAGE_HIGH,
   {
     is_server:false,
-    has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:true,
     has_broken_whoami:false,
@@ -294,7 +285,6 @@ wincaps wincap_10_1903 __attribute__((section (".cygwin_dll_common"), shared)) =
   mmap_storage_high:__MMAP_STORAGE_HIGH,
   {
     is_server:false,
-    has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:true,
     has_broken_whoami:false,
@@ -324,7 +314,6 @@ wincaps wincap_10_2004 __attribute__((section (".cygwin_dll_common"), shared)) =
   mmap_storage_high:__MMAP_STORAGE_HIGH,
   {
     is_server:false,
-    has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:true,
     has_broken_whoami:false,
@@ -354,7 +343,6 @@ wincaps wincap_11 __attribute__((section (".cygwin_dll_common"), shared)) = {
   mmap_storage_high:__MMAP_STORAGE_HIGH,
   {
     is_server:false,
-    has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:true,
     has_broken_whoami:false,


More information about the Cygwin-cvs mailing list