summaryrefslogtreecommitdiff
path: root/libbb/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/time.c')
-rw-r--r--libbb/time.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libbb/time.c b/libbb/time.c
index e66a9cb..86b88a4 100644
--- a/libbb/time.c
+++ b/libbb/time.c
@@ -90,7 +90,11 @@ void FAST_FUNC parse_datestr(const char *date_str, struct tm *ptm)
ptm->tm_mon -= 1; /* Adjust month from 1-12 to 0-11 */
} else
if (date_str[0] == '@') {
- time_t t = bb_strtol(date_str + 1, NULL, 10);
+ time_t t;
+ if (sizeof(t) <= sizeof(long))
+ t = bb_strtol(date_str + 1, NULL, 10);
+ else /* time_t is 64 bits but longs are smaller */
+ t = bb_strtoll(date_str + 1, NULL, 10);
if (!errno) {
struct tm *lt = localtime(&t);
if (lt) {