Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to fix 2038 problem with MSVC #1078

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion crypto/compat/posix_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#define NO_REDEF_POSIX_FUNCTIONS

#include <sys/time.h>

#include <ws2tcpip.h>
#include <windows.h>

Expand Down Expand Up @@ -306,7 +308,7 @@ int gettimeofday(struct timeval * tp, struct timezone * tzp)
time = ((uint64_t)file_time.dwLowDateTime);
time += ((uint64_t)file_time.dwHighDateTime) << 32;

tp->tv_sec = (long)((time - EPOCH) / 10000000L);
tp->tv_sec = (long long)((time - EPOCH) / 10000000L);
tp->tv_usec = (long)(system_time.wMilliseconds * 1000);
return 0;
}
Expand Down
9 changes: 9 additions & 0 deletions include/compat/sys/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@

#ifdef _MSC_VER
#include <winsock2.h>

#define timeval libressl_timeval
#define gettimeofday libressl_gettimeofday

struct timeval {
long long tv_sec;
long tv_usec;
};

int gettimeofday(struct timeval *tp, void *tzp);
#else
#include_next <sys/time.h>
Expand Down
Loading