summaryrefslogtreecommitdiff
path: root/libbb/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/time.c')
-rw-r--r--libbb/time.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libbb/time.c b/libbb/time.c
index 30b760f..1cf2a05 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)
}
}
+time_t FAST_FUNC validate_tm_time(const char *date_str, struct tm *tm_time)
+{
+ time_t t = mktime(tm_time);
+ if (t == (time_t) -1L) {
+ bb_error_msg_and_die(bb_msg_invalid_date, date_str);
+ }
+ return t;
+}
+
#if ENABLE_MONOTONIC_SYSCALL
#include <sys/syscall.h>