summaryrefslogtreecommitdiff
path: root/ext/date
diff options
context:
space:
mode:
authorDerick Rethans <derick@php.net>2008-03-31 09:12:15 +0000
committerDerick Rethans <derick@php.net>2008-03-31 09:12:15 +0000
commitb0b7f4eed1d191402b7ea444e997a08fbcb97969 (patch)
treefc8b2aafffab374fa675a2d04db30cc82a41d3b2 /ext/date
parent3e663ebfef31a5bfb9d2f80fba3a8b81930a4283 (diff)
downloadphp-git-b0b7f4eed1d191402b7ea444e997a08fbcb97969.tar.gz
- MFH: Fixed a bug in formatting timestamps when DST is active in the default
timezone.
Diffstat (limited to 'ext/date')
-rw-r--r--ext/date/php_date.c4
-rw-r--r--ext/date/tests/timestamp-in-dst.phpt11
2 files changed, 13 insertions, 2 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 031cf1cf6b..f1a72e1f98 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -746,9 +746,9 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
offset->abbr = strdup(t->tz_abbr);
} else if (t->zone_type == TIMELIB_ZONETYPE_OFFSET) {
offset = timelib_time_offset_ctor();
- offset->offset = (t->z - (t->dst * 60)) * -60;
+ offset->offset = (t->z) * -60;
offset->leap_secs = 0;
- offset->is_dst = t->dst;
+ offset->is_dst = 0;
offset->abbr = malloc(9); /* GMT±xxxx\0 */
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
localtime ? ((offset->offset < 0) ? '-' : '+') : '+',
diff --git a/ext/date/tests/timestamp-in-dst.phpt b/ext/date/tests/timestamp-in-dst.phpt
new file mode 100644
index 0000000000..5b66351e1f
--- /dev/null
+++ b/ext/date/tests/timestamp-in-dst.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Format timestamp in DST test
+--INI--
+date.timezone=CEST
+--FILE--
+<?php
+error_reporting(E_ALL); // hide e_strict warning about timezones
+var_dump( date_create( '@1202996091' )->format( 'c' ) );
+?>
+--EXPECT--
+string(25) "2008-02-14T13:34:51+00:00"