? themes/xtemplate/xtemplate.css2 Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.390 diff -u -F^f -r1.390 common.inc --- includes/common.inc 16 Sep 2004 16:12:21 -0000 1.390 +++ includes/common.inc 26 Sep 2004 22:46:09 -0000 @@ -960,6 +960,9 @@ function format_date($timestamp, $type = } else { $timezone = variable_get('date_default_timezone', 0); + if (variable_get('daylight_saving_time', 0) && drupal_is_dst($timestamp)) { + $timestamp += 3600; + } } } @@ -1743,6 +1746,58 @@ function drupal_map_assoc($array, $funct } /** + * Check if time is in Daylight Savings Time + * + * @param + * $timestamp a timestamp + * @return + * 0 or 1 + */ +function drupal_is_dst($timestamp) { + + $year = date('Y'); + $timezone = variable_get('date_default_timezone', 0); + + // Information on Daylight Saving time was obtained from http://webexhibits.org/daylightsaving/g.html + switch (variable_get('daylight_saving_time', 0)) { + case 0: + return 0; + case 1: // EU and other European countries + // start of DST (last Sunday in March 1 am GMT) + $dststart = strtotime("-1 week sunday GMT", strtotime("1 april $year GMT")) + 3600; + // end of DST in Europe (last Sunday in October 1 am GMT) + $dstend = strtotime("-1 week sunday GMT", strtotime("1 november $year GMT")) + 3600; + break; + case 2: // Russian Federation + // start of DST (last Sunday in March 2 am local time) + $dststart = strtotime("-1 week sunday GMT", strtotime("1 april $year GMT")) + 7200 + $timezone; + // end of DST (last Sunday in October 2 am local time) + $dstend = strtotime("-1 week sunday GMT", strtotime("1 november $year GMT")) + 7200 + $timezone; + break; + case 3: // Northern America (where applicable) + // start of DST (where applicable) (first Sunday in April 2 am local time) + $dststart = strtotime("1 week sunday GMT", strtotime("1 april $year GMT")) + 7200 + $timezone; + // end of DST (where applicable) (last Sunday in October 2 am local time) + $dstend = strtotime("-1 week sunday GMT", strtotime("1 november $year GMT")) + 7200 + $timezone; + break; + case 4: // Australia + // start of DST (last Sunday in October) + $dststart = strtotime("-1 week sunday GMT", strtotime("1 november $year GMT")) + $timezone; + // end of DST (last Sunday in March) + $dstend = strtotime("-1 week sunday GMT", strtotime("1 april $year GMT")) + $timezone; + break; + case 5: // New Zealand + // start of DST (last Sunday in October) + $dststart = strtotime("-1 week sunday GMT", strtotime("1 november $year GMT")) + $timezone; + // end of DST (third Sunday in March) + $dstend = strtotime("3 week sunday GMT", strtotime("1 march $year GMT")) + $timezone; + break; + } + + return ($dststart <= $timestamp && $timestamp <= $dstend); +} + +/** * Prepare a new XML parser. * * This is a wrapper around xml_parser_create() which extracts the encoding from Index: modules/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node.module,v retrieving revision 1.403 diff -u -F^f -r1.403 node.module --- modules/node.module 21 Sep 2004 18:43:54 -0000 1.403 +++ modules/node.module 26 Sep 2004 22:46:10 -0000 @@ -1064,7 +1053,15 @@ function node_validate($node) { } if (!$node->date) { - $node->date = format_date($node->created, 'custom', 'Y-m-d H:i O'); + if (!variable_get('configurable_timezones', 1)) { + $node->date = format_date($node->created, 'custom', 'Y-m-d H:i'); + if (drupal_is_dst($node->date)) { + $node->date -= 3600; + } + } + else { + $node->date = format_date($node->created, 'custom', 'Y-m-d H:i O'); + } } if (!is_numeric($node->status)) { Index: modules/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system.module,v retrieving revision 1.178 diff -u -F^f -r1.178 system.module --- modules/system.module 22 Sep 2004 17:50:55 -0000 1.178 +++ modules/system.module 26 Sep 2004 22:46:10 -0000 @@ -216,6 +216,15 @@ function system_view_general() { // date settings: $zones = _system_zonelist(); + // Daylight saving time settings + $dst = array(t('None'), + t('EU and other European countries'), + t('Russian Federation'), + t('Northern America (where applicable)'), + t('Australia (where applicable)'), + t('New Zealand') + ); + // date settings: possible date formats $dateshort = array('Y-m-d H:i','m/d/Y - H:i', 'd/m/Y - H:i', 'Y/m/d - H:i', 'm/d/Y - g:ia', 'd/m/Y - g:ia', 'Y/m/d - g:ia', @@ -240,6 +249,7 @@ function system_view_general() { } $group = form_select(t('Default time zone'), 'date_default_timezone', variable_get('date_default_timezone', 0), $zones, t('Select the default site time zone.')); + $group .= form_select(t('Daylight saving time '), 'daylight_saving_time', variable_get('daylight_saving_time', 0), $dst, t('Select the Daylight saving time setting (DST) appropriate for your site. Takes only effect if configurable time zones are disabled. If chosing a setting here, make sure you set your default time zone to standard time.')); $group .= form_radios(t('Configurable time zones'), 'configurable_timezones', variable_get('configurable_timezones', 1), array(t('Disabled'), t('Enabled')), t('Enable or disable user-configurable time zones. When enabled, users can set their own time zone and dates will be updated accordingly.')); $group .= form_select(t('Short date format'), 'date_format_short', variable_get('date_format_short', $dateshort[0]), $dateshortchoices, t('The short format of date display.')); $group .= form_select(t('Medium date format'), 'date_format_medium', variable_get('date_format_medium', $datemedium[0]), $datemediumchoices, t('The medium sized date display.'));