]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
script: don't call strftime() if not necessary
authorKarel Zak <kzak@redhat.com>
Thu, 13 Apr 2017 13:06:52 +0000 (15:06 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 13 Apr 2017 13:06:52 +0000 (15:06 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
term-utils/script.c

index a58590188a6d204bd4aa0e3524c61266b50f1c09..86f92c2264e6645a6bdf6171b640dfe8295b78f7 100644 (file)
@@ -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) {