diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-10-29 13:27:31 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-10-29 13:27:31 +0100 |
commit | 85ca327529afeceed41c1d66d0b7d48c2ffc2a4b (patch) | |
tree | addba6c780c2d0318f7091afb80e9be90f900ad0 /util-linux/rtcwake.c | |
parent | 1f6d2307bafd1e55addac5fc28a71f59fc3bd5ba (diff) | |
download | busybox-w32-85ca327529afeceed41c1d66d0b7d48c2ffc2a4b.tar.gz busybox-w32-85ca327529afeceed41c1d66d0b7d48c2ffc2a4b.tar.bz2 busybox-w32-85ca327529afeceed41c1d66d0b7d48c2ffc2a4b.zip |
*: random code shrink
function old new delta
alarm_handler 50 46 -4
ask 228 211 -17
rtcwake_main 474 455 -19
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/rtcwake.c')
-rw-r--r-- | util-linux/rtcwake.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/util-linux/rtcwake.c b/util-linux/rtcwake.c index 4d2be00f5..f90f73ced 100644 --- a/util-linux/rtcwake.c +++ b/util-linux/rtcwake.c | |||
@@ -141,7 +141,7 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv) | |||
141 | seconds = xatoi(opt_seconds); | 141 | seconds = xatoi(opt_seconds); |
142 | if (opt & RTCWAKE_OPT_TIME) | 142 | if (opt & RTCWAKE_OPT_TIME) |
143 | /* alarm time, time_t (absolute, seconds since 1/1 1970 UTC) */ | 143 | /* alarm time, time_t (absolute, seconds since 1/1 1970 UTC) */ |
144 | alarm_time = xatoi(opt_time); | 144 | alarm_time = xatol(opt_time); |
145 | 145 | ||
146 | if (!alarm_time && !seconds) | 146 | if (!alarm_time && !seconds) |
147 | bb_error_msg_and_die("must provide wake time"); | 147 | bb_error_msg_and_die("must provide wake time"); |
@@ -160,8 +160,6 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv) | |||
160 | 160 | ||
161 | /* relative or absolute alarm time, normalized to time_t */ | 161 | /* relative or absolute alarm time, normalized to time_t */ |
162 | sys_time = time(NULL); | 162 | sys_time = time(NULL); |
163 | if (sys_time == (time_t)-1) | ||
164 | bb_perror_msg_and_die("read system time"); | ||
165 | rtc_time = rtc_read_time(fd, utc); | 163 | rtc_time = rtc_read_time(fd, utc); |
166 | 164 | ||
167 | if (alarm_time) { | 165 | if (alarm_time) { |
@@ -174,7 +172,7 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv) | |||
174 | 172 | ||
175 | sync(); | 173 | sync(); |
176 | printf("wakeup from \"%s\" at %s", suspend, ctime(&alarm_time)); | 174 | printf("wakeup from \"%s\" at %s", suspend, ctime(&alarm_time)); |
177 | fflush(stdout); | 175 | fflush(NULL); |
178 | usleep(10 * 1000); | 176 | usleep(10 * 1000); |
179 | 177 | ||
180 | if (strcmp(suspend, "on")) | 178 | if (strcmp(suspend, "on")) |