rtclocaltime revision 1.2
1#!/bin/sh 2# 3# $NetBSD: rtclocaltime,v 1.2 2004/04/25 16:52:19 schmonz Exp $ 4# 5 6# PROVIDE: rtclocaltime 7# REQUIRE: mountcritremote 8# BEFORE: ntpdate ntpd 9 10. /etc/rc.subr 11 12name="rtclocaltime" 13rcvar=$name 14start_cmd="rtclocaltime_start" 15stop_cmd=":" 16 17rtclocaltime_start() 18{ 19 rtcoff=$(date '+%z' | awk '{ 20 offset = int($1); 21 if (offset < 0) { 22 sign = -1; 23 offset = -offset; 24 } else { 25 sign = 1; 26 } 27 minutes = offset % 100; 28 hours = offset / 100; 29 offset = sign * (hours * 60 + minutes); 30 print offset; 31 }') 32 sysctl -w kern.rtc_offset=$((-1 * $rtcoff)) 33} 34 35load_rc_config $name 36run_rc_command "$1" 37