Modify adjkerntz to not write RTC clock per initial call,

suggested by Bruce
This commit is contained in:
Andrey A. Chernov 1994-10-04 19:15:13 +00:00
parent 03e4d516a4
commit 025dc82971

View File

@ -101,8 +101,8 @@ int main(argc, argv)
len = sizeof(kern_offset);
if (sysctl(mib, 2, &kern_offset, &len, NULL, 0) == -1) {
perror("sysctl(get_offset)");
return 1;
}
return 1;
}
/****** Critical section, do all things as fast as possible ******/
@ -200,10 +200,36 @@ int main(argc, argv)
stz = NULL;
if (stz != NULL || stv != NULL) {
int disrtcset, need_restore = 0;
if (init && stv != NULL) {
mib[0] = CTL_MACHDEP;
mib[1] = CPU_DISRTCSET;
len = sizeof(disrtcset);
if (sysctl(mib, 2, &disrtcset, &len, NULL, 0) == -1) {
perror("sysctl(get_disrtcset)");
return 1;
}
if (disrtcset == 0) {
disrtcset = 1;
need_restore = 1;
if (sysctl(mib, 2, NULL, NULL, &disrtcset, len) == -1) {
perror("sysctl(set_disrtcset)");
return 1;
}
}
}
if (settimeofday(stv, stz)) {
perror("settimeofday");
return 1;
}
if (need_restore) {
disrtcset = 0;
if (sysctl(mib, 2, NULL, NULL, &disrtcset, len) == -1) {
perror("sysctl(restore_disrtcset)");
return 1;
}
}
}
/****** End of critical section ******/