From d05422417eec3fe0b85d158ac1b0bd3d1da4d6c6 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 13 Apr 2017 15:06:52 +0200 Subject: [PATCH] script: don't call strftime() if not necessary Signed-off-by: Karel Zak --- term-utils/script.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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) { -- 2.47.2