From: Karel Zak Date: Thu, 13 Apr 2017 13:06:52 +0000 (+0200) Subject: script: don't call strftime() if not necessary X-Git-Tag: v2.30-rc1~110 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d05422417eec3fe0b85d158ac1b0bd3d1da4d6c6;p=thirdparty%2Futil-linux.git script: don't call strftime() if not necessary Signed-off-by: Karel Zak --- diff --git a/term-utils/script.c b/term-utils/script.c index a58590188a..86f92c2264 100644 --- a/term-utils/script.c +++ b/term-utils/script.c @@ -434,9 +434,10 @@ static void do_io(struct script_control *ctl) } - strftime(buf, sizeof buf, "%c\n", localtime(&tvec)); - if (!ctl->quiet && ctl->typescriptfp) + if (!ctl->quiet && ctl->typescriptfp) { + strftime(buf, sizeof buf, "%c\n", localtime(&tvec)); fprintf(ctl->typescriptfp, _("Script started on %s"), buf); + } gettime_monotonic(&ctl->oldtime); while (!ctl->die) {