Sync usage with man page.
[netbsd-mini2440.git] / etc / rc.d / rtclocaltime
blob70e168f39594c2be9eba7a99137600eba5b5e36f
1 #!/bin/sh
3 # $NetBSD: rtclocaltime,v 1.8 2009/04/08 13:18:56 martin Exp $
6 # PROVIDE: rtclocaltime
7 # REQUIRE: mountcritremote
8 # BEFORE: ntpdate ntpd
10 $_rc_subr_loaded . /etc/rc.subr
12 name="rtclocaltime"
13 rcvar=$name
14 start_cmd="rtclocaltime_start"
15 stop_cmd=":"
17 rtclocaltime_start()
19 rtcoff=$(awk 'BEGIN{
20 offset = -int(strftime("%z"));
21 if (offset < 0) {
22 sign = -1;
23 offset = -offset;
24 } else {
25 sign = 1;
27 minutes = offset % 100;
28 hours = int(offset / 100);
29 offset = sign * (hours * 60 + minutes);
30 print offset;
31 exit(0);
32 }')
33 echo "Setting RTC offset to ${rtcoff}."
34 sysctl -qw kern.rtc_offset=${rtcoff}
37 load_rc_config $name
38 run_rc_command "$1"