diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2020-11-28 23:21:13 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-11-28 23:21:13 +0100 |
commit | 32a8f70ac1caa4037b63747c0c0a5086953ea668 (patch) | |
tree | 796ed8c6940796ffafc00561e1ab75787fb3a317 /libbb | |
parent | 4dee01605996be88ec247256eb47d2686f6b7104 (diff) | |
download | busybox-w32-32a8f70ac1caa4037b63747c0c0a5086953ea668.tar.gz busybox-w32-32a8f70ac1caa4037b63747c0c0a5086953ea668.tar.bz2 busybox-w32-32a8f70ac1caa4037b63747c0c0a5086953ea668.zip |
libbb: in @SECONDS date format, use 64-bit time if libc allows
function old new delta
packed_usage 33472 33486 +14
parse_datestr 919 916 -3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/time.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libbb/time.c b/libbb/time.c index e66a9cba8..86b88a414 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) | |||
90 | ptm->tm_mon -= 1; /* Adjust month from 1-12 to 0-11 */ | 90 | ptm->tm_mon -= 1; /* Adjust month from 1-12 to 0-11 */ |
91 | } else | 91 | } else |
92 | if (date_str[0] == '@') { | 92 | if (date_str[0] == '@') { |
93 | time_t t = bb_strtol(date_str + 1, NULL, 10); | 93 | time_t t; |
94 | if (sizeof(t) <= sizeof(long)) | ||
95 | t = bb_strtol(date_str + 1, NULL, 10); | ||
96 | else /* time_t is 64 bits but longs are smaller */ | ||
97 | t = bb_strtoll(date_str + 1, NULL, 10); | ||
94 | if (!errno) { | 98 | if (!errno) { |
95 | struct tm *lt = localtime(&t); | 99 | struct tm *lt = localtime(&t); |
96 | if (lt) { | 100 | if (lt) { |