php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44296 Incorrect time_t for x86-64
Submitted: 2008-02-29 21:09 UTC Modified: 2008-03-03 08:11 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: rolosworld at gmail dot com Assigned:
Status: Closed Package: Date/time related
PHP Version: 5.2.5 OS: gentoo
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: rolosworld at gmail dot com
New email:
PHP Version: OS:

 

 [2008-02-29 21:09 UTC] 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:


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-03 08:11 UTC] derick@php.net
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.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Dec 10 11:00:02 2025 UTC