File: 90clock

package info (click to toggle)
pm-utils 1.4.1-21
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,432 kB
  • sloc: sh: 3,069; xml: 1,035; makefile: 174; ansic: 152
file content (27 lines) | stat: -rwxr-xr-x 614 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
# Synchronize system time with hardware time.
# Modern kernels handle this correctly so we skip this hook by default.

. "${PM_FUNCTIONS}"

suspend_clock()
{
        printf "Saving system time to hardware clock..."
	/sbin/hwclock --systohc >/dev/null 2>&1 0<&1 && echo Done. || \
	    echo Failed.
}

resume_clock()
{
        printf "Loading system time from hardware clock..."
	/sbin/hwclock --hctosys >/dev/null 2>&1 0<&1 && echo Done. || \
	    echo Failed.
}

is_set "$NEED_CLOCK_SYNC" || exit $NA

case "$1" in
	hibernate|suspend) suspend_clock ;;
	thaw|resume) resume_clock ;;
	*) exit $NA ;;
esac