]> granicus.if.org Git - strace/commitdiff
tests: use print_time_t in utime.test
authorDmitry V. Levin <ldv@altlinux.org>
Sun, 26 Feb 2017 22:57:37 +0000 (22:57 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 26 Feb 2017 22:57:37 +0000 (22:57 +0000)
* tests/utime.c (print_tm): Remove.
(main): Use print_time_t instead of print_tm.

tests/utime.c

index 8fd594f07a2a6d7f2e26c058924df07d3fc8bdd4..7c9b60876760639a991b8195c91b3205703bacab 100644 (file)
 # include <stdio.h>
 # include <unistd.h>
 
-
-static void
-print_tm(const struct tm * const p)
-{
-       char buf[256];
-
-       strftime(buf, sizeof(buf), "%FT%T%z", p);
-
-       printf("%s", buf);
-}
-
 static long
 k_utime(const void *const filename, const void *const times)
 {
@@ -61,7 +50,6 @@ main(void)
        static const char *const dummy_str = "dummy filename";
 
        const time_t t = time(NULL);
-       const struct tm * const p = localtime(&t);
        const struct utimbuf u = { .actime = t, .modtime = t };
        const struct utimbuf *const tail_u = tail_memdup(&u, sizeof(u));
        const char *const dummy_filename =
@@ -81,9 +69,9 @@ main(void)
        rc = k_utime("utime\nfilename", tail_u);
        const char *errstr = sprintrc(rc);
        printf("utime(\"utime\\nfilename\", {actime=");
-       print_tm(p);
+       print_time_t(t);
        printf(", modtime=");
-       print_tm(p);
+       print_time_t(t);
        printf("}) = %s\n", errstr);
 
        puts("+++ exited with 0 +++");