diff options
author | Karel Zak | 2017-04-18 12:02:01 +0200 |
---|---|---|
committer | Karel Zak | 2017-04-18 12:02:01 +0200 |
commit | 4213390597a015065fb9fb3db87f2a0e620e80ca (patch) | |
tree | 21f7932cb879267779955d36113f086cb5f0b9d0 /term-utils/script.c | |
parent | Merge branch 'bash-completion' of git://github.com/kerolasa/lelux-utiliteetit (diff) | |
parent | fix the position of newline in the time output of 'script' (diff) | |
download | kernel-qcow2-util-linux-4213390597a015065fb9fb3db87f2a0e620e80ca.tar.gz kernel-qcow2-util-linux-4213390597a015065fb9fb3db87f2a0e620e80ca.tar.xz kernel-qcow2-util-linux-4213390597a015065fb9fb3db87f2a0e620e80ca.zip |
Merge branch 'script_newline' of https://github.com/renyuneyun/util-linux
* 'script_newline' of https://github.com/renyuneyun/util-linux:
fix the position of newline in the time output of 'script'
Diffstat (limited to 'term-utils/script.c')
-rw-r--r-- | term-utils/script.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/term-utils/script.c b/term-utils/script.c index 86f92c226..19ecddc93 100644 --- a/term-utils/script.c +++ b/term-utils/script.c @@ -70,6 +70,7 @@ #include "ttyutils.h" #include "all-io.h" #include "monotonic.h" +#include "timeutils.h" #include "debug.h" @@ -435,8 +436,10 @@ static void do_io(struct script_control *ctl) if (!ctl->quiet && ctl->typescriptfp) { - strftime(buf, sizeof buf, "%c\n", localtime(&tvec)); - fprintf(ctl->typescriptfp, _("Script started on %s"), buf); + strtime_iso(&tvec, ISO_8601_DATE | ISO_8601_TIME | ISO_8601_DOTUSEC | + ISO_8601_TIMEZONE | ISO_8601_SPACE, + buf, sizeof(buf)); + fprintf(ctl->typescriptfp, _("Script started on %s\n"), buf); } gettime_monotonic(&ctl->oldtime); @@ -509,8 +512,10 @@ static void do_io(struct script_control *ctl) wait_for_child(ctl, 1); if (!ctl->quiet && ctl->typescriptfp) { tvec = script_time((time_t *)NULL); - strftime(buf, sizeof buf, "%c\n", localtime(&tvec)); - fprintf(ctl->typescriptfp, _("\nScript done on %s"), buf); + strtime_iso(&tvec, ISO_8601_DATE | ISO_8601_TIME | ISO_8601_DOTUSEC | + ISO_8601_TIMEZONE | ISO_8601_SPACE, + buf, sizeof(buf)); + fprintf(ctl->typescriptfp, _("\nScript done on %s\n"), buf); } done(ctl); } |