shutdown.c (sysvinit-2.98.tar.xz) | : | shutdown.c (sysvinit-2.99.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 811 | skipping to change at line 811 | |||
lt = localtime(&t); | lt = localtime(&t); | |||
wt = (60*hours + mins) - (60*lt->tm_hour + lt->tm_min); | wt = (60*hours + mins) - (60*lt->tm_hour + lt->tm_min); | |||
if (wt < 0) wt += 1440; | if (wt < 0) wt += 1440; | |||
} | } | |||
} | } | |||
/* Shutdown NOW if time == 0 */ | /* Shutdown NOW if time == 0 */ | |||
if (wt == 0) issue_shutdown(halttype); | if (wt == 0) issue_shutdown(halttype); | |||
/* Rather than loop and reduce wt (wait time) once per minute, | /* Rather than loop and reduce wt (wait time) once per minute, | |||
we shall check the current time against the target time. | we shall check the current time against the target time. | |||
Then calculate the remaining wating time based on the difference | Then calculate the remaining waiting time based on the difference | |||
between current time and target time. | between current time and target time. | |||
This avoids missing shutdown time (target time) after the | This avoids missing shutdown time (target time) after the | |||
computer has been asleep. -- Jesse | computer has been asleep. -- Jesse | |||
*/ | */ | |||
/* target time, in seconds = current time + wait time */ | /* target time, in seconds = current time + wait time */ | |||
time(&t); | time(&t); | |||
target_time = t + (60 * wt); | target_time = t + (60 * wt); | |||
/* Give warnings on regular intervals and finally shutdown. */ | /* Give warnings on regular intervals and finally shutdown. */ | |||
if (wt < 15 && !needwarning(wt, quiet_level)) issue_warn(wt); | if (wt < 15 && !needwarning(wt, quiet_level)) issue_warn(wt); | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added |