Merge to 5_1 branch?

    --Jani


On Tue, 11 Apr 2006, Derick Rethans wrote:

derick          Tue Apr 11 17:56:49 2006 UTC

 Added files:
   /php-src/ext/date/tests      bug36988.phpt

 Modified files:
   /php-src/ext/date/lib        timelib_structs.h tm2unixtime.c
 Log:
 - Fixed bug #36988 (mktime freezes on long numbers)


http://cvs.php.net/viewcvs.cgi/php-src/ext/date/lib/timelib_structs.h?r1=1.19&r2=1.20&diff_format=u
Index: php-src/ext/date/lib/timelib_structs.h
diff -u php-src/ext/date/lib/timelib_structs.h:1.19 
php-src/ext/date/lib/timelib_structs.h:1.20
--- php-src/ext/date/lib/timelib_structs.h:1.19 Sat Apr  8 14:57:42 2006
+++ php-src/ext/date/lib/timelib_structs.h      Tue Apr 11 17:56:49 2006
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */

-/* $Id: timelib_structs.h,v 1.19 2006/04/08 14:57:42 derick Exp $ */
+/* $Id: timelib_structs.h,v 1.20 2006/04/11 17:56:49 derick Exp $ */

#ifndef __TIMELIB_STRUCTS_H__
#define __TIMELIB_STRUCTS_H__
@@ -183,9 +183,10 @@
#define TIMELIB_ZONETYPE_ABBR   2
#define TIMELIB_ZONETYPE_ID     3

-#define SECS_PER_DAY   86400
-#define DAYS_PER_YEAR    365
-#define DAYS_PER_LYEAR   366
+#define SECS_PER_ERA 12622780800L
+#define SECS_PER_DAY       86400
+#define DAYS_PER_YEAR        365
+#define DAYS_PER_LYEAR       366

#define timelib_is_leap(y) ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))

http://cvs.php.net/viewcvs.cgi/php-src/ext/date/lib/tm2unixtime.c?r1=1.15&r2=1.16&diff_format=u
Index: php-src/ext/date/lib/tm2unixtime.c
diff -u php-src/ext/date/lib/tm2unixtime.c:1.15 
php-src/ext/date/lib/tm2unixtime.c:1.16
--- php-src/ext/date/lib/tm2unixtime.c:1.15     Sun Jan  1 13:09:49 2006
+++ php-src/ext/date/lib/tm2unixtime.c  Tue Apr 11 17:56:49 2006
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */

-/* $Id: tm2unixtime.c,v 1.15 2006/01/01 13:09:49 sniper Exp $ */
+/* $Id: tm2unixtime.c,v 1.16 2006/04/11 17:56:49 derick Exp $ */

#include "timelib.h"

@@ -135,6 +135,13 @@
{
        timelib_sll i;
        timelib_sll res = 0;
+       timelib_sll eras;
+
+       eras = (year - 1970) / 400;
+       if (eras != 0) {
+               year = year - (eras * 400);
+               res += (SECS_PER_ERA * eras);
+       }

        if (year >= 1970) {
                for (i = year - 1; i >= 1970; i--) {

http://cvs.php.net/viewcvs.cgi/php-src/ext/date/tests/bug36988.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/bug36988.phpt
+++ php-src/ext/date/tests/bug36988.phpt
--TEST--
Bug #36988 (mktime freezes on long numbers)
--FILE--
<?php
$start = microtime(true);
$a = mktime(1, 1, 1, 1, 1, 11111111111);
echo (microtime(true) - $start) < 1 ? "smaller than one second" : "more than a 
second";
?>
--EXPECT--
smaller than one second



--
Give me your money at @ <http://pecl.php.net/wishlist.php/sniper>
Donating money may make me happier and friendlier for a limited period!
Death to all 4 letter abbreviations starting with P!

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to