Bug #14391 Updated: gmmktime, gmdate work incorrect
| From: | jah@php.net | Date: | Sun, 13 Jan 2002 19:34:48 +0000 |
| Subject: | Bug #14391 Updated: gmmktime, gmdate work incorrect | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-76897@lists.php.net to get a copy of this message | ||
ID: 14391
Updated by: jah
Reported By: pilots@farlep.net
Status: Feedback
Bug Type: Date/time related
Operating System: Windows 2000 Server
PHP Version: 4.0.6
New Comment:
Could be. Could also be that some of the assumptions made in
ext/standard/datetime.c on lines 172-190 are just wrong for
Windows-based systems. I'll do some testing next week, now
that I finally have a Windows test system (with documentation)
aside my trustworthy Linux.
<offtopic>
A machine that can boot two different operating systems is
called 'dual-boot'. Mine boots to Linux, Solaris and Windows
2000. So should it be called 'trial-boot'?
</offtopic>
Previous Comments:
------------------------------------------------------------------------
[2002-01-13 07:45:40] derick@php.net
mmm, I think this is to blame at Microsoft then.
Derick
------------------------------------------------------------------------
[2002-01-13 06:56:08] jah@php.net
Bug confirmed also with 4.1.1 on Windows 2000 server.
Everything fine on Linux (4.1.1 and 4.0.3).
Note that depending on your country, the result might be
wrong on summer time too. I'm too living on a timezone
GMT+2 (Finland), but we didn't switch to using daylight
savings time until 1977. Which is correctly detected on
Linux and wrong on Windows 2000 server (it thinks that we
had daylight savings also on 1970-1976).
------------------------------------------------------------------------
[2002-01-13 05:15:26] mfischer@php.net
Can you test a newer version, say 4.1.1?
------------------------------------------------------------------------
[2002-01-13 04:59:58] max@flipstorm.net
Same problem on 4.0.5 running on solaris and linux.
------------------------------------------------------------------------
[2001-12-09 07:29:35] pilots@farlep.net
Please see the code below. The comments are the result of running this
code on my PC, (my GMT Offset = +2 hours = +7200 sec.)
You may see that the mktime() and date() functions work correct, but
gmmktime() returns wrong value in winter time (when it is not a
daylight saving time), and gmdate returns wrong "Z" parameter.
Note: this bug does not appear on UNIX systems.
<?
$df="d.m.Y - H:i:s (Z), I";
$t=mktime(0,0,0,1,2,1970);
echo "<br><b>Make 02.01.1970 - 00:00:00 (Local):</b><br>",
"Timestamp: $t<br>", // 79200
"GMT: ", gmdate($df,$t), "<br>", // 01.01.1970 - 22:00:00 (7200)
"Local: ", date($df,$t), "<br>", // 02.01.1970 - 00:00:00 (7200)
"----------------------------------------<br>";
$t=gmmktime(0,0,0,1,2,1970);
echo "<br><b>Make 02.01.1970 - 00:00:00 (GMT):</b><br>",
"Timestamp: $t<br>", // 82800 (Why !=86400 ?)
"GMT: ", gmdate($df,$t), "<br>", // 01.01.1970 - 23:00:00 (7200)
"Local: ", date($df,$t), "<br>", // 02.01.1970 - 01:00:00 (7200)
"----------------------------------------<br>";
$t=mktime(0,0,0,7,20,1970);
echo "<br><b>Make 20.07.1970 - 00:00:00 (Local):</b><br>",
"Timestamp: $t<br>", // 17269200
"GMT: ", gmdate($df,$t), "<br>", // 01.07.1970 - 21:00:00 (7200)
"Local: ", date($df,$t), "<br>", // 02.07.1970 - 00:00:00 (10800)
"----------------------------------------<br>";
$t=gmmktime(0,0,0,7,20,1970);
echo "<br><b>Make 20.07.1970 - 00:00:00 (GMT):</b><br>",
"Timestamp: $t<br>", // 17280000 (=86400*200)
"GMT: ", gmdate($df,$t), "<br>", // 02.07.1970 - 00:00:00 (7200)
"Local: ", date($df,$t), "<br>", // 02.07.1970 - 03:00:00 (10800)
"----------------------------------------<br>";
?>
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14391&edit=1