[Pm-utils] [PATCH 06/12] Proposed pm-utils 1.2.3 patches, take 2

Victor Lowther victor.lowther at gmail.com
Sun Nov 30 16:33:14 PST 2008


90clock takes over a second to run on suspend.

Most systems do not need it.  Add NEED_CLOCK_SYNC, and only run hwclock
if it is set.  This will probably go away entirely in a later release.
---
 README.debugging   |    6 ++++++
 man/pm-action.xml  |   13 +++++++++++++
 pm/defaults        |    3 +++
 pm/sleep.d/90clock |    2 ++
 4 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/README.debugging b/README.debugging
index 76be415..47c756a 100644
--- a/README.debugging
+++ b/README.debugging
@@ -21,6 +21,12 @@ End-user customization and debugging:
   environment variable to have that module removed when the system
   suspends and reloaded when the system wakes up.
 
+* If your clock drifts across a sleep/wake cycle, you can use 
+  NEED_CLOCK_SYNC="true" to force pm-utils to synchronize clocks.
+  This is a change in the default behaviour of pm-utils -- 1.2.2.1 and earlier
+  always synchronized clocks, but doing so is slow and most hardware stays in
+  sync without assistance.
+
 * To find out what parameters can be passed to pm-suspend and friends, run them
   with '--help' as the first parameter as root.  This will print out the 
   options that it supports and which hooks or modules handle those options.
diff --git a/man/pm-action.xml b/man/pm-action.xml
index 964676f..a6e064c 100644
--- a/man/pm-action.xml
+++ b/man/pm-action.xml
@@ -486,7 +486,20 @@
             will be surrounded by [square brackets].
           </para>
 	</listitem>
+	</varlistentry>
+	<varlistentry>
+        <term><envar>NEED_CLOCK_SYNC</envar></term>
+        <listitem>
+		<para>
+			If your system clock drifts across a suspend/resume or
+			hiberante/thaw cycle, you should set this to true.
+			This will cause pm-utils to synchronize the system clock
+			whenever we go through a sleep/wake cycle at the expense of 
+			making suspend/resume take longer.
+          </para>
+	</listitem>
       </varlistentry>
+
     </variablelist>
   </refsect1>
 
diff --git a/pm/defaults b/pm/defaults
index c0063c5..db4d59a 100644
--- a/pm/defaults
+++ b/pm/defaults
@@ -47,3 +47,6 @@
 # If you want to ignore commandline parameters, add them here.
 # DROP_PARAMETERS=""
 
+# If you need to synchronize the system clock across a suspend/resume or
+# hibernate/thaw cycle, set this variable.
+# NEED_CLOCK_SYNC="true"
diff --git a/pm/sleep.d/90clock b/pm/sleep.d/90clock
index d824778..5df6e8e 100755
--- a/pm/sleep.d/90clock
+++ b/pm/sleep.d/90clock
@@ -15,6 +15,8 @@ resume_clock()
 	/sbin/hwclock --hctosys >/dev/null 2>&1 0<&1
 }
 
+[ "$NEED_CLOCK_SYNC" ] || exit $NA
+
 case "$1" in
 	hibernate|suspend) suspend_clock ;;
 	thaw|resume) resume_clock ;;
-- 
1.6.0.4



More information about the Pm-utils mailing list