Open
Description
Description
I travelled 15 years into the future, and run the following code:
<?php
var_dump(time());
Resulted in this output:
int(-2081770632)
But I expected this output instead:
int(2213196664)
The problem is
Line 46 in 3d9a0a0
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