forked from enlightenment/efl
Implement time functions in eina for WIN32
This commit is contained in:
parent
df3a9dab23
commit
253f8eaa77
|
@ -184,6 +184,10 @@ get_time(void)
|
|||
struct timespec t;
|
||||
clock_gettime(CLOCK_MONOTONIC, &t);
|
||||
return (double)t.tv_sec + (((double)t.tv_nsec) / 1000000000.0);
|
||||
#elif defined (_MSC_VER)
|
||||
struct timespec t;
|
||||
timespec_get (&t, TIME_UTC);
|
||||
return (double)t.tv_sec + (((double)t.tv_nsec) / 1000000000.0);
|
||||
#else
|
||||
struct timeval timev;
|
||||
gettimeofday(&timev, NULL);
|
||||
|
|
|
@ -39,7 +39,12 @@ _eina_time_get(Eina_Nano_Time *tp)
|
|||
if (!clock_gettime(CLOCK_REALTIME, tp))
|
||||
return 0;
|
||||
# endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
if (timespec_get(tp , TIME_UTC))
|
||||
return 0;
|
||||
else
|
||||
return -1;
|
||||
#else
|
||||
/* FIXME: Have a look if and how we can support CLOCK_MONOTONIC */
|
||||
|
||||
struct timeval tv;
|
||||
|
@ -51,6 +56,7 @@ _eina_time_get(Eina_Nano_Time *tp)
|
|||
tp->tv_nsec = tv.tv_usec * 1000L;
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline long int
|
||||
|
|
|
@ -15,15 +15,15 @@
|
|||
#include <../ucrt/time.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef unsigned short u_short;
|
||||
// typedef unsigned short u_short;
|
||||
|
||||
struct timezone {
|
||||
int tz_minuteswest; /* minutes west of Greenwich */
|
||||
int tz_dsttime; /* type of DST correction */
|
||||
};
|
||||
// struct timezone {
|
||||
// int tz_minuteswest; /* minutes west of Greenwich */
|
||||
// int tz_dsttime; /* type of DST correction */
|
||||
// };
|
||||
|
||||
int gettimeofday(struct timeval * tp, struct timezone * tzp);
|
||||
// int gettimeofday(struct timeval * tp, struct timezone * tzp);
|
||||
|
||||
struct tm *localtime_r(const time_t * time, struct tm * result);
|
||||
// struct tm *localtime_r(const time_t * time, struct tm * result);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue