[LTP] [PATCH] syscalls/time01:Avoid using TST_RET in time() test to support Y2038-safe time_t
Cyril Hrubis
chrubis@suse.cz
Fri Sep 19 18:05:25 CEST 2025
Hi!
Sorry for the late reply.
> + time_t ret_time = time(tloc);
> +
> + ret_time = time(tloc);
>
> - TEST(time(tloc));
> -
> - if (TST_RET == -1) {
> + if (ret_time == -1) {
> tst_res(TFAIL | TTERRNO, "time()");
> return;
> }
>
> if (!tloc)
> - tst_res(TPASS, "time() returned value %ld", TST_RET);
> - else if (*tloc == TST_RET)
> + tst_res(TPASS, "time() returned value %lld", ret_time);
> + else if (*tloc == ret_time)
> tst_res(TPASS,
> - "time() returned value %ld, stored value %jd are same",
> - TST_RET, (intmax_t) *tloc);
> + "time() returned value %lld, stored value %jd are same",
> + ret_time, (intmax_t) *tloc);
The ret_time needs a cast, since it's not always long long. Or we can
just use the %jd and cast to (intmax_t) as we do for the tloc argument.
> else
> tst_res(TFAIL,
> - "time() returned value %ld, stored value %jd are different",
> - TST_RET, (intmax_t) *tloc);
> + "time() returned value %lld, stored value %jd are different",
> + ret_time, (intmax_t) *tloc);
> }
Here as well.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list