Module Name: src
Committed By: martin
Date: Wed Apr 8 13:18:56 UTC 2009
Modified Files:
src/etc/rc.d: rtclocaltime
Log Message:
Awk has strftime() and systime(), so no need to pipe the output of date
into the script - just do it internally.
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/etc/rc.d/rtclocaltime
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/etc/rc.d/rtclocaltime
diff -u src/etc/rc.d/rtclocaltime:1.7 src/etc/rc.d/rtclocaltime:1.8
--- src/etc/rc.d/rtclocaltime:1.7 Sat Aug 25 07:07:39 2007
+++ src/etc/rc.d/rtclocaltime Wed Apr 8 13:18:56 2009
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: rtclocaltime,v 1.7 2007/08/25 07:07:39 apb Exp $
+# $NetBSD: rtclocaltime,v 1.8 2009/04/08 13:18:56 martin Exp $
#
# PROVIDE: rtclocaltime
@@ -16,8 +16,8 @@
rtclocaltime_start()
{
- rtcoff=$(date '+%z' | awk '{
- offset = -int($1);
+ rtcoff=$(awk 'BEGIN{
+ offset = -int(strftime("%z", systime()));
if (offset < 0) {
sign = -1;
offset = -offset;
@@ -28,6 +28,7 @@
hours = int(offset / 100);
offset = sign * (hours * 60 + minutes);
print offset;
+ exit(0);
}')
echo "Setting RTC offset to ${rtcoff}."
sysctl -qw kern.rtc_offset=${rtcoff}