diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-10-08 16:04:50 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-10-08 16:04:50 +0200 |
| commit | 784d095877ed64890700e51494badf17eca2bd82 (patch) | |
| tree | 9c064d66f85beb48acefd0c1a7c84a1fae5a6c02 | |
| parent | ef5bc2c39c8b2dfda3915345f7abb17e1927684d (diff) | |
| download | busybox-w32-784d095877ed64890700e51494badf17eca2bd82.tar.gz busybox-w32-784d095877ed64890700e51494badf17eca2bd82.tar.bz2 busybox-w32-784d095877ed64890700e51494badf17eca2bd82.zip | |
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.c | 8 |
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 @@ | |||
| 30 | #define SYS_POWER_PATH "/sys/power/state" | 30 | #define SYS_POWER_PATH "/sys/power/state" |
| 31 | #define DEFAULT_MODE "standby" | 31 | #define DEFAULT_MODE "standby" |
| 32 | 32 | ||
| 33 | static time_t rtc_time; | ||
| 34 | |||
| 35 | static NOINLINE bool may_wakeup(const char *rtcname) | 33 | static NOINLINE bool may_wakeup(const char *rtcname) |
| 36 | { | 34 | { |
| 37 | ssize_t ret; | 35 | ssize_t ret; |
| @@ -50,7 +48,7 @@ static NOINLINE bool may_wakeup(const char *rtcname) | |||
| 50 | return strncmp(buf, "enabled\n", 8) == 0; | 48 | return strncmp(buf, "enabled\n", 8) == 0; |
| 51 | } | 49 | } |
| 52 | 50 | ||
| 53 | static NOINLINE void setup_alarm(int fd, time_t *wakeup) | 51 | static NOINLINE void setup_alarm(int fd, time_t *wakeup, time_t rtc_time) |
| 54 | { | 52 | { |
| 55 | struct tm *tm; | 53 | struct tm *tm; |
| 56 | struct linux_rtc_wkalrm wake; | 54 | struct linux_rtc_wkalrm wake; |
| @@ -102,6 +100,8 @@ static NOINLINE void setup_alarm(int fd, time_t *wakeup) | |||
| 102 | int rtcwake_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 100 | int rtcwake_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
| 103 | int rtcwake_main(int argc UNUSED_PARAM, char **argv) | 101 | int rtcwake_main(int argc UNUSED_PARAM, char **argv) |
| 104 | { | 102 | { |
| 103 | time_t rtc_time; | ||
| 104 | |||
| 105 | unsigned opt; | 105 | unsigned opt; |
| 106 | const char *rtcname = NULL; | 106 | const char *rtcname = NULL; |
| 107 | const char *suspend; | 107 | const char *suspend; |
| @@ -170,7 +170,7 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv) | |||
| 170 | alarm_time += sys_time - rtc_time; | 170 | alarm_time += sys_time - rtc_time; |
| 171 | } else | 171 | } else |
| 172 | alarm_time = rtc_time + seconds + 1; | 172 | alarm_time = rtc_time + seconds + 1; |
| 173 | setup_alarm(fd, &alarm_time); | 173 | setup_alarm(fd, &alarm_time, rtc_time); |
| 174 | 174 | ||
| 175 | sync(); | 175 | sync(); |
| 176 | printf("wakeup from \"%s\" at %s", suspend, ctime(&alarm_time)); | 176 | printf("wakeup from \"%s\" at %s", suspend, ctime(&alarm_time)); |
