[LTP] [PATCH v2] rtc02: loosen the compare precision with few seconds
Li Wang
liwang@redhat.com
Sun May 8 06:19:28 CEST 2022
On Sun, May 8, 2022 at 11:06 AM Li Wang <liwang@redhat.com> wrote:
> + if (!(set_tm->tm_sec == read_tm->tm_sec)
> + || !(set_tm->tm_min == read_tm->tm_min)
> + || !(set_tm->tm_hour == read_tm->tm_hour)) {
>
nit: I should use 'A != B' directly but not '!(A==B)' in the expression.
That looks strange anyway.
> +
> + seconds1 = (set_tm->tm_hour * 3600) + (set_tm->tm_min *
> 60) + set_tm->tm_sec;
> + seconds2 = (read_tm->tm_hour * 3600) + (read_tm->tm_min *
> 60) + read_tm->tm_sec;
> +
> + delta = seconds2 - seconds1;
> +
> + if (delta < 0 || delta > 3)
>
Better to print seconds value if fails.
--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20220508/3e8b6c9b/attachment.htm>
More information about the ltp
mailing list