diff options
Diffstat (limited to 'libbb/time.c')
-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> |