diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-18 03:41:29 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-18 03:41:29 +0200 |
commit | 7aca89a7a32a1e560c447952c28a8b1e7fb775fc (patch) | |
tree | b988939ee5fc2cf2235847d5f04ba5887b185e05 /libbb | |
parent | 73b71f381d24218cf6368364be723a7b5c9aeda9 (diff) | |
download | busybox-w32-7aca89a7a32a1e560c447952c28a8b1e7fb775fc.tar.gz busybox-w32-7aca89a7a32a1e560c447952c28a8b1e7fb775fc.tar.bz2 busybox-w32-7aca89a7a32a1e560c447952c28a8b1e7fb775fc.zip |
touch: implement -d --date (our own testsuite needs that)
function old new delta
static.uname_longopts - 137 +137
touch_main 231 360 +129
static.touch_longopts - 32 +32
validate_tm_time - 28 +28
packed_usage 26616 26624 +8
date_main 687 686 -1
static.longopts 162 - -162
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 2/1 up/down: 334/-163) Total: 171 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/time.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libbb/time.c b/libbb/time.c index 30b760f71..1cf2a050e 100644 --- a/libbb/time.c +++ b/libbb/time.c | |||
@@ -71,6 +71,15 @@ void FAST_FUNC parse_datestr(const char *date_str, struct tm *tm_time) | |||
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
74 | time_t FAST_FUNC validate_tm_time(const char *date_str, struct tm *tm_time) | ||
75 | { | ||
76 | time_t t = mktime(tm_time); | ||
77 | if (t == (time_t) -1L) { | ||
78 | bb_error_msg_and_die(bb_msg_invalid_date, date_str); | ||
79 | } | ||
80 | return t; | ||
81 | } | ||
82 | |||
74 | #if ENABLE_MONOTONIC_SYSCALL | 83 | #if ENABLE_MONOTONIC_SYSCALL |
75 | 84 | ||
76 | #include <sys/syscall.h> | 85 | #include <sys/syscall.h> |