forked from enlightenment/efl
Windows: sys/time.h: Now implementation is separeted from declaration as should be.
- `src/lib/evil/unposix/sys/time.c` was add to `src/lib/evil/meson.build`; - .c and .h were separeted; - Faulty timezone structure implemented Test plan: - Ninja with `-k0` flag compiles as much as with `src/lib/evil/unposix/sys/time.c` as with the stub and there is no aditional error.
This commit is contained in:
parent
5d5ae6860f
commit
7257d900d1
|
@ -16,6 +16,7 @@ if target_machine.system() == 'windows'
|
|||
'evil_util.c',
|
||||
'evil_private.h',
|
||||
'pcre/regex.h',
|
||||
'unposix/sys/time.c',
|
||||
]
|
||||
|
||||
psapi = cc.find_library('psapi')
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
#include<sys/time.h>
|
||||
|
||||
int gettimeofday(struct timeval * tp, struct timezone * tzp)
|
||||
{
|
||||
// This number is the number of 100 nanosecond intervals since 00:00:00
|
||||
// 01/01/1601 (UTC) (Windows way) until 00:00:00 01/01/1970 (POSIX way)
|
||||
static const uint64_t EPOCH = ((uint64_t) 116444736000000000ULL);
|
||||
|
||||
SYSTEMTIME system_time;
|
||||
FILETIME file_time;
|
||||
uint64_t time;
|
||||
|
||||
GetSystemTime(&system_time);
|
||||
SystemTimeToFileTime( &system_time, &file_time );
|
||||
time = ((uint64_t)file_time.dwLowDateTime ) ;
|
||||
time += ((uint64_t)file_time.dwHighDateTime) << 32;
|
||||
|
||||
tp->tv_sec = (long) ((time - EPOCH) / 10000000L);
|
||||
tp->tv_usec = (long) (system_time.wMilliseconds * 1000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct tm *localtime_r(const time_t * time, struct tm * result)
|
||||
{
|
||||
localtime_s(result, time);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -10,34 +10,17 @@
|
|||
|
||||
typedef unsigned short u_short;
|
||||
|
||||
struct timezone {
|
||||
int tz_minuteswest; /* minutes west of Greenwich */
|
||||
int tz_dsttime; /* type of DST correction */
|
||||
};
|
||||
|
||||
typedef long suseconds_t;
|
||||
|
||||
typedef struct timeval timeval;
|
||||
|
||||
inline int gettimeofday(struct timeval * tp, struct timezone * tzp)
|
||||
{
|
||||
// This number is the number of 100 nanosecond intervals since 00:00:00
|
||||
// 01/01/1601 (UTC) (Windows way) until 00:00:00 01/01/1970 (POSIX way)
|
||||
static const uint64_t EPOCH = ((uint64_t) 116444736000000000ULL);
|
||||
int gettimeofday(struct timeval * tp, struct timezone * tzp);
|
||||
|
||||
SYSTEMTIME system_time;
|
||||
FILETIME file_time;
|
||||
uint64_t time;
|
||||
|
||||
GetSystemTime(&system_time);
|
||||
SystemTimeToFileTime( &system_time, &file_time );
|
||||
time = ((uint64_t)file_time.dwLowDateTime ) ;
|
||||
time += ((uint64_t)file_time.dwHighDateTime) << 32;
|
||||
|
||||
tp->tv_sec = (long) ((time - EPOCH) / 10000000L);
|
||||
tp->tv_usec = (long) (system_time.wMilliseconds * 1000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline struct tm *localtime_r(const time_t * time, struct tm * result)
|
||||
{
|
||||
localtime_s(result, time);
|
||||
return result;
|
||||
}
|
||||
struct tm *localtime_r(const time_t * time, struct tm * result);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue