aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-10-08 16:04:50 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-10-08 16:04:50 +0200
commit784d095877ed64890700e51494badf17eca2bd82 (patch)
tree9c064d66f85beb48acefd0c1a7c84a1fae5a6c02
parentef5bc2c39c8b2dfda3915345f7abb17e1927684d (diff)
downloadbusybox-784d095877ed64890700e51494badf17eca2bd82.tar.gz
rtcwake: remove a static variable
function old new delta rtc_time 4 - -4 rtcwake_main 479 474 -5 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-9) Total: -9 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--util-linux/rtcwake.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/util-linux/rtcwake.c b/util-linux/rtcwake.c
index ee2f031b4..4d2be00f5 100644
--- a/util-linux/rtcwake.c
+++ b/util-linux/rtcwake.c
@@ -30,8 +30,6 @@
#define SYS_POWER_PATH "/sys/power/state"
#define DEFAULT_MODE "standby"
-static time_t rtc_time;
-
static NOINLINE bool may_wakeup(const char *rtcname)
{
ssize_t ret;
@@ -50,7 +48,7 @@ static NOINLINE bool may_wakeup(const char *rtcname)
return strncmp(buf, "enabled\n", 8) == 0;
}
-static NOINLINE void setup_alarm(int fd, time_t *wakeup)
+static NOINLINE void setup_alarm(int fd, time_t *wakeup, time_t rtc_time)
{
struct tm *tm;
struct linux_rtc_wkalrm wake;
@@ -102,6 +100,8 @@ static NOINLINE void setup_alarm(int fd, time_t *wakeup)
int rtcwake_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int rtcwake_main(int argc UNUSED_PARAM, char **argv)
{
+ time_t rtc_time;
+
unsigned opt;
const char *rtcname = NULL;
const char *suspend;
@@ -170,7 +170,7 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv)
alarm_time += sys_time - rtc_time;
} else
alarm_time = rtc_time + seconds + 1;
- setup_alarm(fd, &alarm_time);
+ setup_alarm(fd, &alarm_time, rtc_time);
sync();
printf("wakeup from \"%s\" at %s", suspend, ctime(&alarm_time));