summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerick Rethans <derick@php.net>2008-07-27 19:09:37 +0000
committerDerick Rethans <derick@php.net>2008-07-27 19:09:37 +0000
commitd4210b7a4aa76dfe6f38eeede2b485bcd00707c5 (patch)
treea87f3fedf0a3b0071cc1a9d2792e09e1109767d7
parente10ebdfee7d92e105d711c51f255bd02acc4aaf6 (diff)
downloadphp-git-d4210b7a4aa76dfe6f38eeede2b485bcd00707c5.tar.gz
- Fixed DateTime::setTimestamp() and added a test for it.
-rw-r--r--ext/date/php_date.c2
-rw-r--r--ext/date/tests/date-set-timestamp.phpt16
2 files changed, 17 insertions, 1 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 60f9d9f4f3..969928cad7 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -3230,7 +3230,7 @@ PHP_FUNCTION(date_timestamp_set)
}
dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
- timelib_unixtime2gmt(dateobj->time, (timelib_sll)timestamp);
+ timelib_unixtime2local(dateobj->time, (timelib_sll)timestamp);
timelib_update_ts(dateobj->time, NULL);
}
/* }}} */
diff --git a/ext/date/tests/date-set-timestamp.phpt b/ext/date/tests/date-set-timestamp.phpt
new file mode 100644
index 0000000000..7a2b8f7acd
--- /dev/null
+++ b/ext/date/tests/date-set-timestamp.phpt
@@ -0,0 +1,16 @@
+--TEST--
+DateTime::setTimestamp()
+--INI--
+date.timezone=Europe/Oslo
+--FILE--
+<?php
+$d = new DateTime( '@1217184864' );
+echo $d->format( "Y-m-d H:i e\n" );
+
+$d = new DateTime();
+$d->setTimestamp( 1217184864 );
+echo $d->format( "Y-m-d H:i e\n" );
+?>
+--EXPECT--
+2008-07-27 18:54 +00:00
+2008-07-27 20:54 Europe/Oslo