diff --git a/clock.module b/clock.module index 2af52c7..3c257a9 100755 --- a/clock.module +++ b/clock.module @@ -111,7 +111,7 @@ function clock_block_configure($delta = '') { // Each date format type has a corresponding variable. If it is not set, // get the list of date formats for that type and use the first one. $date_format = variable_get('date_format_' . $date_type, key(system_get_date_formats($date_type))); - $date_types[$date_type] = $info['title'] . ' (' . date_format_date(date_now(_clock_get_timezone()), 'custom', $date_format) . ')'; + $date_types[$date_type] = $info['title'] . ' (' . date_format_date(date_now(_clock_get_timezone(TRUE)), 'custom', $date_format) . ')'; } $form['date_type'] = array( '#type' => 'radios', @@ -171,11 +171,15 @@ function clock_block_view($delta = '') { /** * Gets the correct timezone to display. * + * @param $date_format_date + * Whether or not the returned time zone is directly used in + * date_format_date(). Defaults to FALSE. + * * @return * The name of the timezone, NULL if the user's time zone is to be used or * 'Local' if the user's local time is to be used. */ -function _clock_get_timezone() { +function _clock_get_timezone($date_format_date = FALSE) { $time_zone = variable_get('clock_time_zone', 2); switch ($time_zone) { // Site time zone. @@ -188,7 +192,7 @@ function _clock_get_timezone() { break; // Local time zone. case 3: - $time_zone = 'Local'; + $time_zone = ($date_format_date ? variable_get('date_default_timezone', 'UTC') : 'Local'); break; } // If the time zone type is 'Custom time zone', $time_zone directly contains