summaryrefslogtreecommitdiff
path: root/pm/sleep.d/90clock
blob: d82477881b00bc7e47e95f4b65d8567880a73e76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
# Synchronize system time with hardware time.
# TODO: Do modern kernels handle this correctly?  If so, we should detect that
#       and skip this hook.

. "${PM_FUNCTIONS}"

suspend_clock()
{
	/sbin/hwclock --systohc >/dev/null 2>&1 0<&1
}

resume_clock()
{
	/sbin/hwclock --hctosys >/dev/null 2>&1 0<&1
}

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