summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertise.dev>2020-05-04 19:10:47 -0300
committerFelipe Magno de Almeida <felipe@expertise.dev>2020-05-04 22:11:45 -0300
commit253f8eaa77c43ab2136774c00fc8b477ebedcca1 (patch)
tree2964cd32416f83245fa75df3f29456d1e787b31e
parentdf3a9dab23327164eece31deae99617c1551dd1b (diff)
Implement time functions in eina for WIN32
-rw-r--r--src/lib/eina/eina_debug_bt.c4
-rw-r--r--src/lib/eina/eina_inline_private.h8
-rw-r--r--src/lib/evil/unposix/sys/time.h14
3 files changed, 18 insertions, 8 deletions
diff --git a/src/lib/eina/eina_debug_bt.c b/src/lib/eina/eina_debug_bt.c
index 3b23c622c1..639580d212 100644
--- a/src/lib/eina/eina_debug_bt.c
+++ b/src/lib/eina/eina_debug_bt.c
@@ -184,6 +184,10 @@ get_time(void)
184 struct timespec t; 184 struct timespec t;
185 clock_gettime(CLOCK_MONOTONIC, &t); 185 clock_gettime(CLOCK_MONOTONIC, &t);
186 return (double)t.tv_sec + (((double)t.tv_nsec) / 1000000000.0); 186 return (double)t.tv_sec + (((double)t.tv_nsec) / 1000000000.0);
187#elif defined (_MSC_VER)
188 struct timespec t;
189 timespec_get (&t, TIME_UTC);
190 return (double)t.tv_sec + (((double)t.tv_nsec) / 1000000000.0);
187#else 191#else
188 struct timeval timev; 192 struct timeval timev;
189 gettimeofday(&timev, NULL); 193 gettimeofday(&timev, NULL);
diff --git a/src/lib/eina/eina_inline_private.h b/src/lib/eina/eina_inline_private.h
index 846081dd88..7133ba61c1 100644
--- a/src/lib/eina/eina_inline_private.h
+++ b/src/lib/eina/eina_inline_private.h
@@ -39,7 +39,12 @@ _eina_time_get(Eina_Nano_Time *tp)
39 if (!clock_gettime(CLOCK_REALTIME, tp)) 39 if (!clock_gettime(CLOCK_REALTIME, tp))
40 return 0; 40 return 0;
41# endif 41# endif
42 42#ifdef _MSC_VER
43 if (timespec_get(tp , TIME_UTC))
44 return 0;
45 else
46 return -1;
47#else
43/* FIXME: Have a look if and how we can support CLOCK_MONOTONIC */ 48/* FIXME: Have a look if and how we can support CLOCK_MONOTONIC */
44 49
45 struct timeval tv; 50 struct timeval tv;
@@ -51,6 +56,7 @@ _eina_time_get(Eina_Nano_Time *tp)
51 tp->tv_nsec = tv.tv_usec * 1000L; 56 tp->tv_nsec = tv.tv_usec * 1000L;
52 57
53 return 0; 58 return 0;
59#endif
54} 60}
55 61
56static inline long int 62static inline long int
diff --git a/src/lib/evil/unposix/sys/time.h b/src/lib/evil/unposix/sys/time.h
index 5c5de33523..4c991130b7 100644
--- a/src/lib/evil/unposix/sys/time.h
+++ b/src/lib/evil/unposix/sys/time.h
@@ -15,15 +15,15 @@
15#include <../ucrt/time.h> 15#include <../ucrt/time.h>
16#include <sys/types.h> 16#include <sys/types.h>
17 17
18typedef unsigned short u_short; 18// typedef unsigned short u_short;
19 19
20struct timezone { 20// struct timezone {
21 int tz_minuteswest; /* minutes west of Greenwich */ 21// int tz_minuteswest; /* minutes west of Greenwich */
22 int tz_dsttime; /* type of DST correction */ 22// int tz_dsttime; /* type of DST correction */
23}; 23// };
24 24
25int gettimeofday(struct timeval * tp, struct timezone * tzp); 25// int gettimeofday(struct timeval * tp, struct timezone * tzp);
26 26
27struct tm *localtime_r(const time_t * time, struct tm * result); 27// struct tm *localtime_r(const time_t * time, struct tm * result);
28 28
29#endif 29#endif