stefan pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=f09080fad504653a32c902b9dff6ff7940ec6f92

commit f09080fad504653a32c902b9dff6ff7940ec6f92
Author: Lucas <[email protected]>
Date:   Tue Jul 28 20:26:35 2020 +0000

    evil: Remove unnecessary delay for evil startup
    
    Apparently there were two loops intended for an older (and dropped
    off) implementation of `gettimeofday`. This patch simplifies the code 
removing
    these loops and significantly lowering evil startup.
    
    Without this patch `ecore-suite`, `efl-app` and `evas-suite` gets timeout in
    Windows:
    ```
    25/29 ecore-suite               TIMEOUT        30.12s
    26/29 efl-app                   TIMEOUT        30.14s
    ...
    29/29 evas-suite                TIMEOUT        60.07s
    ```
    
    Reviewed-by: Vincent Torri <[email protected]>
    Reviewed-by: Stefan Schmidt <[email protected]>
    Differential Revision: https://phab.enlightenment.org/D12064
---
 src/lib/evil/evil_main.c   | 28 ++--------------------------
 src/lib/evil/evil_main.h   |  5 ++---
 src/lib/evil/evil_unistd.c | 30 +-----------------------------
 3 files changed, 5 insertions(+), 58 deletions(-)

diff --git a/src/lib/evil/evil_main.c b/src/lib/evil/evil_main.c
index cd7fde8555..6a3678f0a1 100644
--- a/src/lib/evil/evil_main.c
+++ b/src/lib/evil/evil_main.c
@@ -11,19 +11,14 @@ static int      _evil_init_count = 0;
 
 extern LONGLONG _evil_time_freq;
 extern LONGLONG _evil_time_count;
-extern long     _evil_time_second;
 
 extern DWORD    _evil_tls_index;
 
-long _evil_systemtime_to_time(SYSTEMTIME st);
-
 int
 evil_init(void)
 {
-   SYSTEMTIME    st;
    LARGE_INTEGER freq;
    LARGE_INTEGER count;
-   WORD          second = 59;
 
    if (++_evil_init_count != 1)
      return _evil_init_count;
@@ -39,30 +34,11 @@ evil_init(void)
         }
    }
 
-   if (!QueryPerformanceFrequency(&freq))
-       return 0;
+   QueryPerformanceFrequency(&freq);
 
    _evil_time_freq = freq.QuadPart;
 
-   /* be sure that second + 1 != 0 */
-   while (second == 59)
-     {
-        GetSystemTime(&st);
-        second = st.wSecond;
-     }
-
-   /* retrieve the tick corresponding to the time we retrieve above */
-   while (1)
-     {
-        GetSystemTime(&st);
-        QueryPerformanceCounter(&count);
-        if (st.wSecond == second + 1)
-          break;
-     }
-
-   _evil_time_second = _evil_systemtime_to_time(st);
-   if (_evil_time_second < 0)
-     return --_evil_init_count;
+   QueryPerformanceCounter(&count);
 
    _evil_time_count = count.QuadPart;
 
diff --git a/src/lib/evil/evil_main.h b/src/lib/evil/evil_main.h
index 44b8356e4d..40fd38f15f 100644
--- a/src/lib/evil/evil_main.h
+++ b/src/lib/evil/evil_main.h
@@ -93,9 +93,8 @@
  * @brief Initialize the Evil library.
  *
  * This function initializes the Evil library. It must be called before
- * using evil_time_get(), gettimeofday() or pipe(). It returns  0 on
- * failure, otherwise it returns the number of times it has already been
- * called.
+ * using evil_time_get() or pipe(). It returns  0 on failure, otherwise it
+ * returns the number of times it has already been called.
  *
  * When Evil is not used anymore, call evil_shutdown() to shut down
  * the Evil library.
diff --git a/src/lib/evil/evil_unistd.c b/src/lib/evil/evil_unistd.c
index 3eebf97e1e..535ef71231 100644
--- a/src/lib/evil/evil_unistd.c
+++ b/src/lib/evil/evil_unistd.c
@@ -17,34 +17,6 @@
 
 LONGLONG _evil_time_freq;
 LONGLONG _evil_time_count;
-long     _evil_time_second;
-
-
-long _evil_systemtime_to_time(SYSTEMTIME st);
-
-long
-_evil_systemtime_to_time(SYSTEMTIME st)
-{
-   int days[] = {
-     -1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364
-   };
-   int day;
-   time_t t;
-
-   st.wYear -= 1900;
-   if ((st.wYear < 70) || (st.wYear > 138))
-     return -1;
-
-   day = st.wDay + days[st.wMonth - 1];
-
-  if (!(st.wYear & 3) && (st.wMonth > 2) )
-    day++;
-
-  t = ((st.wYear - 70) * 365 + ((st.wYear - 1) >> 2) - 17 + day) * 24 + 
st.wHour;
-  t = (t * 60 + st.wMinute) * 60 + st.wSecond;
-
-  return (long)t;
-}
 
 /*
  * Time related functions
@@ -58,7 +30,7 @@ evil_time_get(void)
 
    QueryPerformanceCounter(&count);
 
-   return (double)_evil_time_second + (double)(count.QuadPart - 
_evil_time_count)/ (double)_evil_time_freq;
+   return (double)(count.QuadPart - _evil_time_count)/ (double)_evil_time_freq;
 }
 
 

-- 


Reply via email to