Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions src/memwatch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,38 @@
#include <sstream>

#include <math.h> // for pow
#include <time.h> // for time
#include <sys/time.h>
// #include <time.h> // for time
// #include <sys/time.h>
#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

using namespace v8;
using namespace node;
Expand Down