diff options
author | Victor Lowther <victor.lowther@gmail.com> | 2008-05-18 10:25:01 -0500 |
---|---|---|
committer | Victor Lowther <victor.lowther@gmail.com> | 2008-05-18 10:25:01 -0500 |
commit | cc55fcd04883f1462144eb3efdbb1c09fe7d6089 (patch) | |
tree | 6835e83dfc1ee3673e59f6bee71ce40159a59810 /pm/sleep.d/90clock | |
parent | a95fac932e9f9a921690860bd01f4e5b88b619c2 (diff) |
Split the NTP handling code in 90clock into its own code.
While I was at it, reorganized the hooks to conform to the new
ordering convention.
Diffstat (limited to 'pm/sleep.d/90clock')
-rwxr-xr-x | pm/sleep.d/90clock | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/pm/sleep.d/90clock b/pm/sleep.d/90clock index 985b266..d824778 100755 --- a/pm/sleep.d/90clock +++ b/pm/sleep.d/90clock @@ -1,41 +1,22 @@ #!/bin/sh # Synchronize system time with hardware time. -# TODO: Split NTP handling to its own hook. Having it here is ugly and silly. -# Do modern kernels handle this correctly? If so, we should detect that +# TODO: Do modern kernels handle this correctly? If so, we should detect that # and skip this hook. . "${PM_FUNCTIONS}" -NTPD_LOCK="pm-ntpd.lock" - suspend_clock() { - if try_lock "${NTPD_LOCK}"; then - trap 'release_lock "${NTPD_LOCK}"' 0 - stopservice ntpd - fi /sbin/hwclock --systohc >/dev/null 2>&1 0<&1 } resume_clock() { /sbin/hwclock --hctosys >/dev/null 2>&1 0<&1 - rc=$? - # Bring back ntpd _after_ NetworkManager and such come back... - ( spin_lock "${NTPD_LOCK}"; - trap 'release_lock "${NTPD_LOCK}"' 0 - sleep 20; - restartservice ntpd; ) & - return $rc } case "$1" in - hibernate|suspend) - suspend_clock - ;; - thaw|resume) - resume_clock - ;; - *) exit $NA - ;; + hibernate|suspend) suspend_clock ;; + thaw|resume) resume_clock ;; + *) exit $NA ;; esac |