Description
I travelled 15 years into the future, and run the following code:
Resulted in this output:
But I expected this output instead:
The problem is
|
tv->tv_sec = (long)(ff / 1000000Ui64); |
Casting to long is appropriate since the declaration of struct timeval in WinSock2.h is:
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* and microseconds */
};
However, long is a 32bit value on LLP64 architectures.
One may argue that time travel is not supportable, but maybe we should heed the POSIX 7 advise:
Applications should use the clock_gettime() function instead of the obsolescent gettimeofday() function.
gettimeofday() has been removed from POSIX 8 altogether.
PHP Version
any
Operating System
Windows
Description
I travelled 15 years into the future, and run the following code:
Resulted in this output:
But I expected this output instead:
The problem is
php-src/win32/time.c
Line 46 in 3d9a0a0
Casting to
longis appropriate since the declaration ofstruct timevalin WinSock2.h is:However,
longis a 32bit value on LLP64 architectures.One may argue that time travel is not supportable, but maybe we should heed the POSIX 7 advise:
gettimeofday()has been removed from POSIX 8 altogether.PHP Version
any
Operating System
Windows