summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWander Lairson Costa <wander.lairson@gmail.com>2020-06-23 20:20:14 +0000
committerStefan Schmidt <s.schmidt@samsung.com>2020-08-20 09:36:23 +0200
commit1ee6e020bb623e91df9c10a161efd01ba2a45603 (patch)
treeebf50d13fcc2333144f8d32b4d3b2a50024bb186
parentbfc3e9f96ec3089545bcd67c3c2a4c9e9c4f405f (diff)
eina_test_lock.c: Implement clock_gettime for Windows
Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Reviewed-by: Vincent Torri <vincent.torri@gmail.com> Differential Revision: https://phab.enlightenment.org/D12023
-rw-r--r--src/tests/eina/eina_test_lock.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/tests/eina/eina_test_lock.c b/src/tests/eina/eina_test_lock.c
index 583ca1a7a9..bbf036b203 100644
--- a/src/tests/eina/eina_test_lock.c
+++ b/src/tests/eina/eina_test_lock.c
@@ -53,6 +53,25 @@ clock_gettime(int mode, struct timespec* ts)
53 53
54 return 0; 54 return 0;
55} 55}
56
57# elif defined(_WIN32)
58
59# define CLOCK_REALTIME 0
60
61int
62clock_gettime(int mode, struct timespec* ts)
63{
64 FILETIME sys_time;
65 ULARGE_INTEGER li_sys_time;
66
67 GetSystemTimeAsFileTime(&sys_time);
68 li_sys_time.u.LowPart = sys_time.dwLowDateTime;
69 li_sys_time.u.HighPart = sys_time.dwHighDateTime;
70 ts->tv_sec = li_sys_time.QuadPart / 10000000UL;
71 ts->tv_nsec = (li_sys_time.QuadPart % 10000000UL) * 100UL;
72 return 0;
73}
74
56# else /* ! __MACH__ */ 75# else /* ! __MACH__ */
57# error No support for clock_gettime() 76# error No support for clock_gettime()
58# endif /* __MACH__ */ 77# endif /* __MACH__ */