NYCPHP Meetup

NYPHP.org

[nycphp-talk] gmmktime weirdness

Hans Zaunere hans at nyu.edu
Thu Apr 3 11:41:58 EST 2003


  PHP 4.3.0 (Apache DSO) on RH 7.3

1049598000 = Sat, 05 Apr 2003 22:00:00 EST expected 2:00 AM
1049599800 = Sun, 06 Apr 2003 03:30:00 GMT expected 2:30 AM
1049598000 = Sun, 06 Apr 2003 03:00:00 GMT expected 3:00 AM
1049598000 = Sun, 06 Apr 2003 03:00:00 GMT expected 2:00 AM
1049599800 = Sun, 06 Apr 2003 03:30:00 GMT expected 2:30 AM
1049598000 = Sun, 06 Apr 2003 03:00:00 GMT expected 3:00 AM


H

Lance Lovette wrote:

>Wow. Although not too surprising, those values are way off base. I'm running
>Red Hat 7.2. Can anyone produce results from a Red Hat server running PHP
>4.3.x? I want to know the current behavior of gmmktime before I submit a new
>bug report.
>
>-----Original Message-----
>From: Hans Zaunere [mailto:hans at nyu.edu] 
>Sent: Wednesday, April 02, 2003 4:28 PM
>To: NYPHP Talk
>Subject: Re: [nycphp-talk] gmmktime weirdness
>
>
>
>Lance Lovette wrote:
>
>  
>
>>Can someone do me a favor and run this script with the latest release 
>>of PHP and tell me what the output is for them?
>>
>><?php
>>$t = gmmktime(2, 0, 0, 4, 6, 2003);
>>printf('%d = %s expected 2:00 AM<br>', $t, gmdate('D, d M Y H:i:s T', 
>>$t));
>>$t = gmmktime(2, 30, 0, 4, 6, 2003); 
>>printf('%d = %s expected 2:30 AM<br>', $t, gmdate('D, d M Y H:i:s T', $t));
>>    
>>
>
>  
>
>>$t = gmmktime(3, 0, 0, 4, 6, 2003); 
>>printf('%d = %s expected 3:00 AM<br>', $t, gmdate('D, d M Y H:i:s T', $t));
>>
>>gmmktime(0, 0, 0, 1, 1, 1970); // causes later calls to gmmktime to be 
>>wrong
>>
>>$t = gmmktime(2, 0, 0, 4, 6, 2003);
>>printf('%d = %s expected 2:00 AM<br>', $t, gmdate('D, d M Y H:i:s T', 
>>$t));
>>$t = gmmktime(2, 30, 0, 4, 6, 2003); 
>>printf('%d = %s expected 2:30 AM<br>', $t, gmdate('D, d M Y H:i:s T', $t));
>>    
>>
>
>  
>
>>$t = gmmktime(3, 0, 0, 4, 6, 2003); 
>>printf('%d = %s expected 3:00 AM<br>', $t, gmdate('D, d M Y H:i:s T', $t));
>>    
>>
>
>  
>
>>?>
>>
>>I'm running version 4.2.1 and the output makes no sense to me.
>>
>>1049590800 = Sun, 06 Apr 2003 01:00:00 GMT expected 2:00 AM
>>1049592600 = Sun, 06 Apr 2003 01:30:00 GMT expected 2:30 AM 
>>1049598000 = Sun, 06 Apr 2003 03:00:00 GMT expected 3:00 AM 
>>1049598000 = Sun, 06 Apr 2003 03:00:00 GMT expected 2:00 AM 
>>1049599800 = Sun, 06 Apr 2003 03:30:00 GMT expected 2:30 AM 
>>1049598000 = Sun, 06 Apr 2003 03:00:00 GMT expected 3:00 AM
>>
>>First off, calling gmmktime in the middle of the script changes the 
>>return value of later gmmktime calls even though they are identical to 
>>the first set of calls. Second, I figured gmmktime(2, 0, 0, 4, 6, 2003) 
>>would always return 2 AM even though that's when the time "Springs 
>>forward" for me.
>>
>>    
>>
>http://hans.newyorkphp.com/gmmktime.tmp.php
>
>Probably not what you wanted to see.  That's on a FreeBSD 4.7 system, 
>and there are significant bugs (that I think some of the PHP folks are 
>trying to skirt :) in relation to DST, mktime() and BSD.
>
>http://bugs.php.net/bug.php?id=22163
>
>is just one of them.  Search for mktime and gmmktime at bugs.php.net as 
>well.
>
>H
>
>
>
>
>
>
>
>
>
>
>--- Unsubscribe at http://nyphp.org/list/ ---
>
>
>  
>




More information about the talk mailing list