Skip to content

Commit

Permalink
Merge pull request #16 from RapidAI/main
Browse files Browse the repository at this point in the history
Add missing files.
  • Loading branch information
chenkui164 authored Sep 9, 2022
2 parents 7403396 + a95f1b2 commit 435bae8
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions include/win_func.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <time.h>
#ifdef WIN32
#include <windows.h>
#else
#include <sys/time.h>
#endif
#ifdef WIN32
int gettimeofday(struct timeval* tp, void* tzp)
{
time_t clock;
struct tm tm;
SYSTEMTIME wtm;

GetLocalTime(&wtm);
tm.tm_year = wtm.wYear - 1900;
tm.tm_mon = wtm.wMonth - 1;
tm.tm_mday = wtm.wDay;
tm.tm_hour = wtm.wHour;
tm.tm_min = wtm.wMinute;
tm.tm_sec = wtm.wSecond;
tm.tm_isdst = -1;

clock = mktime(&tm);
tp->tv_sec = clock;
tp->tv_usec = wtm.wMilliseconds * 1000;
return (0);
}
#endif

0 comments on commit 435bae8

Please sign in to comment.