-
Notifications
You must be signed in to change notification settings - Fork 269
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
gettimeofday implementation for MSVC cannot handle dates beyond 2038 #1076
Comments
Thanks. Looks like that would need some compat implementation of gettimeofday via GetSystemTime and SystemTimeToFileTime or something like that. Would be nice if the OS provided a fix on the system level rather than requiring downstreams to come up with workarounds for its brokenness... |
The funcion is already compat implemented here: portable/crypto/compat/posix_win.c Line 292 in cd0ae0e
but when declaring portable/include/compat/sys/time.h Line 11 in cd0ae0e
we are taking the timeval declaration from winsock2.h, that is a signed 32 bits. |
Right. I need to fix the aggressive If we're lucky, the diff below works. I'm unsure how diff --git a/include/compat/sys/time.h b/include/compat/sys/time.h
index 76428c1..2448969 100644
--- a/include/compat/sys/time.h
+++ b/include/compat/sys/time.h
@@ -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>
|
See #1078. It would be great if you could check if this addresses the issue. |
MSVC gettimeofday implementation rely on the definition of timeval provided by winsock2.h
https://learn.microsoft.com/en-us/windows/win32/api/winsock2/ns-winsock2-timeval
typedef struct timeval {
long tv_sec;
long tv_usec;
} TIMEVAL, *PTIMEVAL, *LPTIMEVAL;
this give us potential errors when dealing with dates bigger than the year 2038, i.e. OpenSSH-Portable hangs if the machine date is set to a year bigger than 2039
Connection is stuck when time on SSH Server is set after the Year-2038 Problem
The text was updated successfully, but these errors were encountered: