From 9fe1548bbfde548d54acaab113656a56ea0ccc72 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Thu, 16 Sep 2021 10:26:14 +0100 Subject: date,touch: allow timezone offsets in dates Allow ISO 8601 style dates to include a timezone offset. Like the '@' format these dates aren't relative to the user's current timezone and shouldn't be subject to DST adjustment. - The implementation uses the strptime() '%z' format specifier. This an extension which may not be available so the use of timezones is a configuration option. - The 'touch' applet has been updated to respect whether DST adjustment is required, matching 'date'. function old new delta parse_datestr 624 730 +106 static.fmt_str 106 136 +30 touch_main 388 392 +4 date_main 818 819 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 141/0) Total: 141 bytes Signed-off-by: Ron Yorston Signed-off-by: Denys Vlasenko --- include/libbb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/libbb.h b/include/libbb.h index 7d6ab4a..1ec8d2d 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -690,7 +690,7 @@ struct BUG_too_small { }; -void parse_datestr(const char *date_str, struct tm *ptm) FAST_FUNC; +int parse_datestr(const char *date_str, struct tm *ptm) FAST_FUNC; time_t validate_tm_time(const char *date_str, struct tm *ptm) FAST_FUNC; char *strftime_HHMMSS(char *buf, unsigned len, time_t *tp) FAST_FUNC; char *strftime_YYYYMMDDHHMMSS(char *buf, unsigned len, time_t *tp) FAST_FUNC; -- cgit v1.1