summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorDerick Rethans <derick@php.net>2005-10-15 18:12:29 +0000
committerDerick Rethans <derick@php.net>2005-10-15 18:12:29 +0000
commit33921efc4408ce442a098c52ba91d5ae753daa8a (patch)
tree0325b384dd217e4e1eae45165e6c4e0ea298ccd7 /ext
parentb343aa994586bca54c1c23187416455d6e4f24a9 (diff)
downloadphp-git-33921efc4408ce442a098c52ba91d5ae753daa8a.tar.gz
- Fixed timezone guessing on Windows. (Derick, Nuno)
Diffstat (limited to 'ext')
-rw-r--r--ext/date/lib/fallbackmap.h8
-rw-r--r--ext/date/php_date.c17
2 files changed, 17 insertions, 8 deletions
diff --git a/ext/date/lib/fallbackmap.h b/ext/date/lib/fallbackmap.h
index b6c3760616..7189eb88e3 100644
--- a/ext/date/lib/fallbackmap.h
+++ b/ext/date/lib/fallbackmap.h
@@ -1,3 +1,4 @@
+ { "sst", 0, -11, "Pacific/Apia" },
{ "hst", 0, -10, "Pacific/Honolulu" },
{ "akst", 0, -9, "America/Anchorage" },
{ "akdt", 1, -8, "America/Anchorage" },
@@ -10,7 +11,11 @@
{ "est", 0, -5, "America/New_York" },
{ "edt", 1, -4, "America/New_York" },
{ "ast", 0, -4, "America/Halifax" },
- { "adt", 0, -3, "America/Halifax" },
+ { "adt", 1, -3, "America/Halifax" },
+ { "brt", 0, -3, "America/Sao_Paulo" },
+ { "brst", 1, -2, "America/Sao_Paulo" },
+ { "azost", 0, -1, "Atlantic/Azores" },
+ { "azodt", 1, 0, "Atlantic/Azores" },
{ "gmt", 0, 0, "Europe/London" },
{ "bst", 1, 1, "Europe/London" },
{ "cet", 0, 1, "Europe/Paris" },
@@ -23,6 +28,7 @@
{ "pkt", 0, 5, "Asia/Karachi" },
{ "ist", 0, 5.5, "Asia/Calcutta" },
{ "npt", 0, 5.75, "Asia/Katmandu" },
+ { "yekt", 1, 6, "Asia/Yekaterinburg" },
{ "novst", 1, 7, "Asia/Novosibirsk" },
{ "krat", 0, 7, "Asia/Krasnoyarsk" },
{ "krast", 1, 8, "Asia/Krasnoyarsk" },
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 73648d2d5e..b4acfd4dad 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -337,26 +337,29 @@ static char* guess_timezone(TSRMLS_D)
switch (GetTimeZoneInformation(&tzi))
{
+ /* no DST or not in effect */
case TIME_ZONE_ID_UNKNOWN:
- /* we have no clue what it is, return UTC */
- php_error_docref(NULL TSRMLS_CC, E_STRICT, "It is not safe to rely on the systems timezone settings, please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We use 'UTC' instead.");
- tzid = "UTC";
- break;
-
case TIME_ZONE_ID_STANDARD:
+php_win_std_time:
tzid = timelib_timezone_id_from_abbr("", (tzi.Bias + tzi.StandardBias) * -60, 0);
if (! tzid) {
tzid = "UTC";
}
- php_error_docref(NULL TSRMLS_CC, E_STRICT, "It is not safe to rely on the systems timezone settings, please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We use '%s' for '%.1f/no DST' instead.", tzid, (float) ((tzi.Bias + tzi.StandardBias) / -60));
+ php_error_docref(NULL TSRMLS_CC, E_STRICT, "It is not safe to rely on the systems timezone settings, please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We use '%s' for '%.1f/no DST' instead.", tzid, ((tzi.Bias + tzi.StandardBias) / -60.0));
break;
+ /* DST in effect */
case TIME_ZONE_ID_DAYLIGHT:
+ /* If user has disabled DST in the control panel, Windows returns 0 here */
+ if (tzi.DaylightBias == 0) {
+ goto php_win_std_time;
+ }
+
tzid = timelib_timezone_id_from_abbr("", (tzi.Bias + tzi.DaylightBias) * -60, 1);
if (! tzid) {
tzid = "UTC";
}
- php_error_docref(NULL TSRMLS_CC, E_STRICT, "It is not safe to rely on the systems timezone settings, please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We use '%s' for '%.1f/DST' instead.", tzid, (float) ((tzi.Bias + tzi.DaylightBias) / -60));
+ php_error_docref(NULL TSRMLS_CC, E_STRICT, "It is not safe to rely on the systems timezone settings, please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We use '%s' for '%.1f/DST' instead.", tzid, ((tzi.Bias + tzi.DaylightBias) / -60.0));
break;
}
return tzid;