[debian-edu-commits] r81779 - in trunk/src/shutdown-at-night: . debian

pere at alioth.debian.org pere at alioth.debian.org
Sun Jul 21 10:43:28 UTC 2013


Author: pere
Date: 2013-07-21 10:43:28 +0000 (Sun, 21 Jul 2013)
New Revision: 81779

Modified:
   trunk/src/shutdown-at-night/debian/changelog
   trunk/src/shutdown-at-night/shutdown-at-night
Log:
Correct time zone calculations, try to ensure that the 07:00 wake
up time is in the local time zone and not UTC.

Modified: trunk/src/shutdown-at-night/debian/changelog
===================================================================
--- trunk/src/shutdown-at-night/debian/changelog	2013-07-21 06:22:05 UTC (rev 81778)
+++ trunk/src/shutdown-at-night/debian/changelog	2013-07-21 10:43:28 UTC (rev 81779)
@@ -2,6 +2,8 @@
 
   * Add support for using the ACPI RTC wakeup interface to wake up the
     machine (Closes: #717441).
+  * Correct time zone calculations, try to ensure that the 07:00 wake
+    up time is in the local time zone and not UTC.
 
  -- Petter Reinholdtsen <pere at debian.org>  Mon, 15 Jul 2013 17:26:08 +0200
 

Modified: trunk/src/shutdown-at-night/shutdown-at-night
===================================================================
--- trunk/src/shutdown-at-night/shutdown-at-night	2013-07-21 06:22:05 UTC (rev 81778)
+++ trunk/src/shutdown-at-night/shutdown-at-night	2013-07-21 10:43:28 UTC (rev 81779)
@@ -37,11 +37,16 @@
     return 1
 }
 
+# Take wakeup hour:minute in local time zone and return wake up time
+# in seconds since EPOC UTC, radomized around the target wakeup time.
 whentowakeup() {
     wakeuptime=$1
     # Spread the BIOS wakeup time across a 20 minute period, to avoid
     # all of them waking up at the same time, killing a fuse.
-    echo $(( $(date -u +%s -d "tomorrow $wakeuptime") - 600 + $RANDOM % 1200))
+
+    # Convert local target time in seconds since EPOC UTC
+    targettime=$(date +%s -d "tomorrow $wakeuptime $(date +%z)")
+    echo $(( $targettime - 600 + $RANDOM % 1200))
 }
 
 nvramwakeup() {




More information about the debian-edu-commits mailing list