? LICENSE.txt
? clock.make
Index: clock.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/clock/clock.js,v
retrieving revision 1.9.2.2
diff -u -p -r1.9.2.2 clock.js
--- clock.js	7 Apr 2010 23:09:45 -0000	1.9.2.2
+++ clock.js	10 Apr 2010 16:36:47 -0000
@@ -1,4 +1,4 @@
-// $Id: clock.js,v 1.9.2.2 2010/04/07 23:09:45 tstoeckler Exp $
+// $Id: clock.js,v 1.9 2010/02/02 02:05:36 tstoeckler Exp $
 
 /*
  * Gets the date format and time zone related parameters from PHP and formats the date according
@@ -9,7 +9,7 @@ Drupal.behaviors.clockDisplay = function
   // Whether or not to update the clock continuously
   var clockUpdate = Drupal.settings['0'];
   // Gets a PHP timestamp, which counts the seconds since the begin of the UNIX-era.
-  var clockTimestampString = Drupal.settings['1'];
+  var clockTime = Drupal.settings['1'];
   // The time zone offset in seconds.
   var clockTimezoneOffsetSeconds = Drupal.settings['2'];
   // The name of the timezone, e.g. 'Europe/London'.
@@ -21,14 +21,10 @@ Drupal.behaviors.clockDisplay = function
   // A PHP date format string.
   var clockDateFormat = Drupal.settings['6'];
 
-  // Calculate the timestamp with the time zone offset and turn it into milliseconds.
-  // JavaScript's time handling is based on milliseconds, while PHP's is based on seconds.
-  // TODO: Either remove the '-3600'-hack that currently makes this work, or figure out why it is needed.
-  var clockTimestamp = (parseInt(clockTimestampString) - 3600 + parseInt(clockTimezoneOffsetSeconds)) * 1000;
+  var clockDate = new Date(clockTime);
 
   // Calculate whether it is a leap year or not. Years that are multiples of 4 are leap years,
   // while multiples of 100 are not, but multiples of 400 are. That way 1600, 2000, 2004, 2008 were leap years, while 1700, 1800, 1900 were not.
-  var clockDate = new Date(clockTimestamp);
   var year = clockDate.getFullYear();
   if (((year % 4) == 0) && ((year % 100) != 0) || ((year % 400) == 0)) {
     var leapYear = '1';
@@ -383,8 +379,11 @@ Drupal.behaviors.clockDisplay = function
       var clockDate = new Date();
     }
     else {
-      var clockDate = new Date(clockTimestamp);
+      var clockDate = new Date(clockTime);
     }
+
+    var clockTimestamp = clockDate.getTime();
+
     clock = formatDate(clockDate, clockTimestamp, clockDateFormat, clockTimezoneOffsetSeconds, clockTimezoneName, clockDaylightSavingsTime, clockOffsetName);
     $('div.clock').html(clock);
 
@@ -392,16 +391,13 @@ Drupal.behaviors.clockDisplay = function
 
       // Recalculate the date every second. '.everyTime' is provided by jQuery Timers.
       $(document).everyTime(1000, function() {
+
         // Add 1 second to the timestamp.
         clockTimestamp = clockTimestamp + 1000;
-        // Format the timestamp into the given format.
-        if (clockTimezoneName == 'Local') {
-          clockDate = new Date();
-        }
-        else {
-          clockDate = new Date(clockTimestamp);
-        }
-        clock = formatDate(clockDate, clockTimestamp, clockDateFormat, clockTimezoneOffsetSeconds, clockTimezoneName, clockDaylightSavingsTime, clockOffsetName);
+        clockDate = new Date(clockTimestamp);
+
+        clock = formatDate(clockDate, clockTimestamp, clockDateFormat, clockTimezoneOffsetSeconds, clockTimezoneName, 1, clockOffsetName);
+
         $('div.clock').html(clock);
       }, 0);
     }
Index: clock.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/clock/clock.module,v
retrieving revision 1.9.2.4
diff -u -p -r1.9.2.4 clock.module
--- clock.module	22 Mar 2010 17:03:15 -0000	1.9.2.4
+++ clock.module	10 Apr 2010 16:36:47 -0000
@@ -220,8 +220,8 @@ function theme_clock($timezone = 'UTC', 
 
     // Create variables that are needed for the JavaScript time calculation.
 
-    // Create a timestamp.
-    $clock_timestamp = date_format_date(date_make_date($date = 'now', $timezone = $clock_timezone), $type = 'custom', $format = 'U');
+    // Create a time string.
+    $clock_time = date_format_date(date_make_date($date = 'now', $timezone = $clock_timezone), $type = 'custom', $format = 'F j, Y H:i:s');
     // Get the time zone offset in seconds.
     $clock_timezone_offset_seconds = date_format_date(date_make_date($date = 'now', $timezone = $clock_timezone), $type = 'custom', $format = 'Z');
     // Get the name of the time zone, e.g. 'Europe/London'.
@@ -255,7 +255,7 @@ function theme_clock($timezone = 'UTC', 
     // Pass the variables to JavaScript.
     drupal_add_js(array(
       '0' => $clock_js,
-      '1' => $clock_timestamp,
+      '1' => $clock_time,
       '2' => $clock_timezone_offset_seconds,
       '3' => $clock_timezone_name,
       '4' => $clock_daylight_savings_time,
