[git commit] date: for -uR and -uIh, timezone still have to be shown at +hhmm, not as abbreviation

Denys Vlasenko vda.linux at googlemail.com
Sat Nov 28 19:58:42 UTC 2020


commit: https://git.busybox.net/busybox/commit/?id=ab6991c6f59ff2960885bbdec57892e9d0f89598
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
date_main                                            963     941     -22

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 coreutils/date.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/coreutils/date.c b/coreutils/date.c
index d84e1c31a..d8a2e8618 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -320,18 +320,16 @@ int date_main(int argc UNUSED_PARAM, char **argv)
 			i = 8 + 3 * ifmt;
 			if (ifmt != 0) {
 				/* TODO: if (ifmt==4) i += sprintf(&fmt_dt2str[i], ",%09u", nanoseconds); */
- format_utc:
 				fmt_dt2str[i++] = '%';
-				fmt_dt2str[i++] = (opt & OPT_UTC) ? 'Z' : 'z';
+				fmt_dt2str[i++] = 'z';
+				/* FIXME: %z prints "+hhmm" timezone, but coreutils-8.30 prints "+hh:mm" */
 			}
 			fmt_dt2str[i] = '\0';
 		} else if (opt & OPT_RFC2822) {
 			/* -R. undo busybox.c setlocale */
 			if (ENABLE_LOCALE_SUPPORT)
 				setlocale(LC_TIME, "C");
-			strcpy(fmt_dt2str, "%a, %d %b %Y %H:%M:%S ");
-			i = sizeof("%a, %d %b %Y %H:%M:%S ")-1;
-			goto format_utc;
+			strcpy(fmt_dt2str, "%a, %d %b %Y %H:%M:%S %z");
 		} else { /* default case */
 			fmt_dt2str = (char*)"%a %b %e %H:%M:%S %Z %Y";
 		}


More information about the busybox-cvs mailing list