Back out previous (which worked but made the code harder to understand),
and implement a different method of avoiding a "-0" result.
This commit is contained in:
parent
6c35be946a
commit
e2832b6345
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: rtclocaltime,v 1.6 2007/08/24 17:02:32 martin Exp $
|
||||
# $NetBSD: rtclocaltime,v 1.7 2007/08/25 07:07:39 apb Exp $
|
||||
#
|
||||
|
||||
# PROVIDE: rtclocaltime
|
||||
@ -17,8 +17,8 @@ stop_cmd=":"
|
||||
rtclocaltime_start()
|
||||
{
|
||||
rtcoff=$(date '+%z' | awk '{
|
||||
offset = int($1);
|
||||
if (offset <= 0) {
|
||||
offset = -int($1);
|
||||
if (offset < 0) {
|
||||
sign = -1;
|
||||
offset = -offset;
|
||||
} else {
|
||||
@ -27,7 +27,7 @@ rtclocaltime_start()
|
||||
minutes = offset % 100;
|
||||
hours = int(offset / 100);
|
||||
offset = sign * (hours * 60 + minutes);
|
||||
print (-1 * offset);
|
||||
print offset;
|
||||
}')
|
||||
echo "Setting RTC offset to ${rtcoff}."
|
||||
sysctl -qw kern.rtc_offset=${rtcoff}
|
||||
|
Loading…
Reference in New Issue
Block a user