#44296 [Opn->Csd]: Incorrect time_t for x86-64
ID: 44296
Updated by: derick@php.net
Reported By: rolosworld at gmail dot com
-Status: Open
+Status: Closed
Bug Type: Date/time related
Operating System: gentoo
PHP Version: 5.2.5
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
This was fixed two weeks ago in CVS.
Previous Comments:
------------------------------------------------------------------------
[2008-02-29 21:09:43] rolosworld at gmail dot com
Description:
------------
Linux localhost 2.6.22-hardened-r8 #2 SMP Tue Dec 4 21:57:04 CST 2007
x86_64 Dual-Core AMD Opteron(tm) Processor 1210 AuthenticAMD GNU/Linux
Im having problems with the date functions, seems the time_t used by
php is 32bit, but the time_t of the system is 64bit.
PHP uses 64bit integers so php is compiled for 64bit.
To check the system time_t:
#include <cstdio>
#include <ctime>
int main ()
{
printf ("Size of time_t %d.\n", sizeof(time_t));
return 0;
}
g++ t.cpp -o t
OUTPUT:
Size of time_t 8.
g++ -m32 t.cpp -o t
OUTPUT:
Size of time_t 4.
Reproduce code:
---------------
<?php
echo "size: ",PHP_INT_SIZE,"\n";
echo "max: ",PHP_INT_MAX,"\n";
echo "mktime1: ",mktime(21,14,7,1,18,2038),"\n";
echo "mktime1: ",mktime(21,14,8,1,18,2038),"\n";
?>
Expected result:
----------------
size: 8
max: 9223372036854775807
mktime1: 2147483647
mktime2: 2147483648
Actual result:
--------------
size: 8
max: 9223372036854775807
mktime1: 2147483647
mktime2:
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44296&edit=1
Thread (2 messages)