From 4111bb3ab5f406ee381a3807385af59fe33b28f3 Mon Sep 17 00:00:00 2001 From: J William Piggott Date: Sat, 14 Oct 2017 20:37:11 -0400 Subject: lib/timeutils: add common ISO timestamp masks * Start the ISO format flags at bit 0 instead of bit 1. * Remove unnecessary _8601 from ISO format flag names to avoid line wrapping and to ease readability. * ISO timestamps have date-time-timzone in common, so move the TIMEZONE flag to bit 2 causing all timestamp masks to have the first three bits set and the last four bits as timestamp 'options'. * Change the 'SPACE' flag to a 'T' flag, because it makes the code and comments more concise. * Add common ISO timestamp masks. * Implement the ISO timestamp masks in all applicable code using the strxxx_iso() functions. Signed-off-by: J William Piggott --- term-utils/script.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'term-utils/script.c') diff --git a/term-utils/script.c b/term-utils/script.c index cf63ab336..f991de14e 100644 --- a/term-utils/script.c +++ b/term-utils/script.c @@ -472,9 +472,7 @@ static void do_io(struct script_control *ctl) if (ctl->typescriptfp) { - strtime_iso(&tvec, ISO_8601_DATE | ISO_8601_TIME | - ISO_8601_TIMEZONE | ISO_8601_SPACE, - buf, sizeof(buf)); + strtime_iso(&tvec, ISO_TIMESTAMP, buf, sizeof(buf)); fprintf(ctl->typescriptfp, _("Script started on %s\n"), buf); } gettime_monotonic(&ctl->oldtime); @@ -546,9 +544,7 @@ static void do_io(struct script_control *ctl) if (ctl->typescriptfp) { tvec = script_time((time_t *)NULL); - strtime_iso(&tvec, ISO_8601_DATE | ISO_8601_TIME | - ISO_8601_TIMEZONE | ISO_8601_SPACE, - buf, sizeof(buf)); + strtime_iso(&tvec, ISO_TIMESTAMP, buf, sizeof(buf)); fprintf(ctl->typescriptfp, _("\nScript done on %s\n"), buf); } done(ctl); -- cgit v1.2.3-55-g7522