summaryrefslogtreecommitdiff
path: root/ext/standard/datetime.c
diff options
context:
space:
mode:
authorAndrei Zmievski <andrei@php.net>2000-06-09 20:18:36 +0000
committerAndrei Zmievski <andrei@php.net>2000-06-09 20:18:36 +0000
commit3570258050ecd292b33cfe6a905d9397ac49ff0c (patch)
tree5471c6dfdb6328006fb5d12a33031fdf1d35299e /ext/standard/datetime.c
parentb51aa1f36f16ab7beba93cd4ecec941b9f0937ed (diff)
downloadphp-git-3570258050ecd292b33cfe6a905d9397ac49ff0c.tar.gz
@- Fixed 'Z' flag in date() to adjust for daylight savings time. (Andrei)
Diffstat (limited to 'ext/standard/datetime.c')
-rw-r--r--ext/standard/datetime.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c
index 7aaedd6972..6c88b42566 100644
--- a/ext/standard/datetime.c
+++ b/ext/standard/datetime.c
@@ -54,6 +54,7 @@ char *day_short_names[] =
#if !defined(HAVE_TM_ZONE) && !defined(_TIMEZONE) && !defined(HAVE_DECLARED_TIMEZONE)
extern time_t timezone;
+extern int daylight;
#endif
static int phpday_tab[2][12] =
@@ -404,9 +405,9 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
break;
case 'Z': /* timezone offset in seconds */
#if HAVE_TM_GMTOFF
- sprintf(tmp_buff, "%ld", ta->tm_gmtoff );
+ sprintf(tmp_buff, "%ld", ta->tm_isdst ? ta->tm_gmtoff-3600 : ta->tm_gmtoff);
#else
- sprintf(tmp_buff, "%ld", timezone);
+ sprintf(tmp_buff, "%ld", daylight ? timezone-3600 : timezone);
#endif
strcat(return_value->value.str.val, tmp_buff);
break;