[wing] Remove wing_get_monotonic_time



commit 66534d54350b932a8fc7349888d601af0cbddd6d
Author: Ignacio Casal Quinteiro <qignacio amazon com>
Date:   Fri Dec 22 09:15:00 2017 +0100

    Remove wing_get_monotonic_time
    
    This was actually moved to glib, so we can use now
    g_get_monotonic_time

 wing/meson.build |    4 ----
 wing/wing-init.c |    2 --
 wing/wing-init.h |   25 -------------------------
 wing/wingutils.c |   42 ------------------------------------------
 wing/wingutils.h |    3 ---
 5 files changed, 0 insertions(+), 76 deletions(-)
---
diff --git a/wing/meson.build b/wing/meson.build
index f839e79..ec028bb 100644
--- a/wing/meson.build
+++ b/wing/meson.build
@@ -12,10 +12,6 @@ headers = [
   'wingutils.h',
 ]
 
-private_headers = [
-  'wing-init.h',
-]
-
 sources = [
   'wingcredentials.c',
   'wingeventwindow.c',
diff --git a/wing/wing-init.c b/wing/wing-init.c
index aa3188a..bfc44dd 100644
--- a/wing/wing-init.c
+++ b/wing/wing-init.c
@@ -15,7 +15,6 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "wing-init.h"
 #include <windows.h>
 
 BOOL WINAPI DllMain (HINSTANCE hinstDLL,
@@ -33,7 +32,6 @@ DllMain (HINSTANCE hinstDLL,
     {
     case DLL_PROCESS_ATTACH:
       wing_dll = hinstDLL;
-      wing_init_monotonic_time ();
       break;
     default:
       /* do nothing */
diff --git a/wing/wingutils.c b/wing/wingutils.c
index 5282138..1cc1e49 100644
--- a/wing/wingutils.c
+++ b/wing/wingutils.c
@@ -74,48 +74,6 @@ wing_get_version_number (gint *major,
   return TRUE;
 }
 
-static gdouble monotonic_usec_per_tick = 0;
-
-/* NOTE:
- * time_usec = ticks_since_boot * usec_per_sec / ticks_per_sec
- *
- * Doing (ticks_since_boot * usec_per_sec) before the division can overflow 64 bits
- * (ticks_since_boot  / ticks_per_sec) and then multiply would not be accurate enough.
- * So for now we calculate (usec_per_sec / ticks_per_sec) and use floating point
- */
-
-void
-wing_init_monotonic_time (void)
-{
-  LARGE_INTEGER freq;
-
-  if (!QueryPerformanceFrequency (&freq) || freq.QuadPart == 0)
-    {
-      g_warning ("Unable to use QueryPerformanceCounter (%d). Fallback to low resolution timer", 
GetLastError ());
-      monotonic_usec_per_tick = 0;
-      return;
-    }
-
-  monotonic_usec_per_tick = (gdouble)G_USEC_PER_SEC / freq.QuadPart;
-}
-
-gint64
-wing_get_monotonic_time (void)
-{
-  if (G_LIKELY (monotonic_usec_per_tick != 0))
-    {
-      LARGE_INTEGER ticks;
-
-      if (QueryPerformanceCounter (&ticks))
-        return (gint64)(ticks.QuadPart * monotonic_usec_per_tick);
-
-      g_warning ("QueryPerformanceCounter Failed (%d). Permanently fallback to low resolution timer", 
GetLastError ());
-      monotonic_usec_per_tick = 0;
-    }
-
-  return g_get_monotonic_time ();
-}
-
 gboolean
 wing_get_process_memory (gsize *total_virtual_memory,
                          gsize *total_physical_memory)
diff --git a/wing/wingutils.h b/wing/wingutils.h
index a25b207..da6653b 100644
--- a/wing/wingutils.h
+++ b/wing/wingutils.h
@@ -34,9 +34,6 @@ gboolean     wing_get_version_number   (gint *major,
                                         gint *minor);
 
 WING_AVAILABLE_IN_ALL
-gint64       wing_get_monotonic_time   (void);
-
-WING_AVAILABLE_IN_ALL
 gboolean     wing_get_process_memory   (gsize *total_virtual_memory,
                                         gsize *total_physical_memory);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]