? jquery.timers.js Index: clock.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/clock/clock.js,v retrieving revision 1.9.2.5 diff -u -p -r1.9.2.5 clock.js --- clock.js 3 May 2010 16:30:49 -0000 1.9.2.5 +++ clock.js 7 May 2010 11:53:41 -0000 @@ -11,7 +11,9 @@ Drupal.behaviors.clockDisplay = function // Gets the correct variables from PHP. // Whether or not to update the clock continuously - var update = Drupal.settings['js']; + var update = Drupal.settings['update']; + // Whether or not to use the client's local time. + var local = Drupal.settings['local']; // Creates a JavaScript date object, from a specially formatted date string. var date = new Date(Drupal.settings['time']); // The time zone offset in seconds. @@ -19,9 +21,13 @@ Drupal.behaviors.clockDisplay = function // The name of the timezone, e.g. 'Europe/London'. var timezoneName = Drupal.settings['timezone_name']; // If time zone is set to 'Local' overwrite the date. - if (timezoneName == 'Local') { - var date = new Date(); + // Note that due to JavaScript's inferior time zone handling, time zone + // related date formatters will return the time zone of the Drupal site, not + // the visiting user. + if (local) { + date = new Date(); } + // Daylight Savings Time information. '1' for yes, '0' for no. var daylightSavingsTime = Drupal.settings['daylight_savings_time']; // The name of the offset, e.g. 'GMT'. Index: clock.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/clock/clock.module,v retrieving revision 1.9.2.9 diff -u -p -r1.9.2.9 clock.module --- clock.module 3 May 2010 16:06:13 -0000 1.9.2.9 +++ clock.module 7 May 2010 11:53:42 -0000 @@ -273,6 +273,12 @@ function clock_get_date_format() { function theme_clock($timezone, $date_format, $js) { if ($js == '1' || $timezone == 'Local') { + if ($timezone == 'Local') { + $local = TRUE; + // Use the site time zone as a fallback for non-JavaScript users. + $timezone = variable_get('date_default_timezone_name', 'UTC'); + } + // Create variables that are needed for the JavaScript time calculation. // Create a time string. $time = date_format_date(date_now($timezone), $type = 'custom', $format = 'F j, Y H:i:s'); @@ -286,7 +292,8 @@ function theme_clock($timezone, $date_fo // Pass the variables to JavaScript. drupal_add_js(array( - 'js' => $js, + 'update' => $js, + 'local' => $local, 'time' => $time, 'offset_seconds' => $offset_seconds, 'timezone_name' => $timezone,