diff options
author | Ron Yorston <rmy@pobox.com> | 2017-12-09 09:17:19 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2017-12-09 09:17:19 +0000 |
commit | 096aee2bb468d1ab044de36e176ed1f6c7e3674d (patch) | |
tree | 58bfe36779e992cfb991586b4a4bf70a06f20584 | |
parent | 0ee8c3a412f461aabfd5d17f2056ffa3fe735f07 (diff) | |
download | busybox-w32-096aee2bb468d1ab044de36e176ed1f6c7e3674d.tar.gz busybox-w32-096aee2bb468d1ab044de36e176ed1f6c7e3674d.tar.bz2 busybox-w32-096aee2bb468d1ab044de36e176ed1f6c7e3674d.zip |
date: support '-' format flag to remove zero padding
The strftime provided by the Microsoft C runtime uses '#' as the
format string flag to remove zero padding; glibc uses '-'.
Support the use of the '-' flag for improved compatibility.
-rw-r--r-- | win32/mingw.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index afcb6c6d2..a55fb4f40 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -905,6 +905,11 @@ size_t mingw_strftime(char *buf, size_t max, const char *format, const struct tm | |||
905 | t = newfmt + m + 1; | 905 | t = newfmt + m + 1; |
906 | fmt = newfmt; | 906 | fmt = newfmt; |
907 | } | 907 | } |
908 | else if ( t[1] == '-' && t[2] != '\0' && | ||
909 | strchr("dHIjmMSUwWyY", t[2]) ) { | ||
910 | /* Microsoft uses '#' rather than '-' to remove padding */ | ||
911 | t[1] = '#'; | ||
912 | } | ||
908 | else if ( t[1] != '\0' ) { | 913 | else if ( t[1] != '\0' ) { |
909 | ++t; | 914 | ++t; |
910 | } | 915 | } |