Skip to content

Commit d0a898d

Browse files
author
Derick Rethans
committed
- Fixed bug #60236 (TLA timezone dates are not converted properly from
timestamp). - Fixed bug #55253 (DateTime::add() and sub() result -1 hour on objects with time zone type 2). And fixed some test cases.
1 parent 22f80ea commit d0a898d

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

ext/date/lib/unixtime2tm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void timelib_update_from_sse(timelib_time *tm)
146146
int z = tm->z;
147147
signed int dst = tm->dst;
148148

149-
timelib_unixtime2gmt(tm, tm->sse - (tm->z * 60));
149+
timelib_unixtime2gmt(tm, tm->sse - (tm->z * 60) + (tm->dst * 3600));
150150

151151
tm->z = z;
152152
tm->dst = dst;
@@ -184,7 +184,7 @@ void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
184184
int z = tm->z;
185185
signed int dst = tm->dst;
186186

187-
timelib_unixtime2gmt(tm, ts - (tm->z * 60));
187+
timelib_unixtime2gmt(tm, ts - (tm->z * 60) + (tm->dst * 3600));
188188

189189
tm->z = z;
190190
tm->dst = dst;

ext/date/tests/bug55253.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
--TEST--
2-
DateTime::add() and sub() result -1 hour on objects with time zone type 2
2+
Bug #55253: DateTime::add() and sub() result -1 hour on objects with time zone type 2
33
--CREDITS--
44
Daniel Convissor <[email protected]>
5-
--XFAIL--
6-
Bug 55253 exists
75
--FILE--
86
<?php
97

ext/date/tests/bug60236.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Bug #60236: TLA timezone dates are not converted properly from timestamp
3+
--FILE--
4+
<?php
5+
$t = new DateTime('2010-07-06 18:38:28 EDT');
6+
$ts = $t->format('U');
7+
var_dump($ts);
8+
$t->setTimestamp($ts);
9+
var_dump($t);
10+
?>
11+
--EXPECT--
12+
string(10) "1278455908"
13+
object(DateTime)#1 (3) {
14+
["date"]=>
15+
string(19) "2010-07-06 18:38:28"
16+
["timezone_type"]=>
17+
int(2)
18+
["timezone"]=>
19+
string(3) "EDT"
20+
}

ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
RFC: DateTime and Daylight Saving Time Transitions (zone type 2)
33
--CREDITS--
44
Daniel Convissor <[email protected]>
5-
--XFAIL--
6-
RFC not implemented yet
75
--FILE--
86
<?php
97

0 commit comments

Comments
 (0)