Skip to content

make 64-bit time_t back to unsigned - #11466

Merged
xiaoxiang781216 merged 1 commit into
apache:masterfrom
yamt:time_t
Dec 30, 2023
Merged

xiaoxiang781216 merged 1 commit into
apache:masterfrom
yamt:time_t

Conversation

@yamt

@yamt yamt commented Dec 29, 2023

Copy link
Copy Markdown
Contributor

Summary

it has been changed by #10303 without any explicit mentions. i suppose it was a mistake.

see #8201 and referenced PRs for previous discussions.

Impact

Testing

it has been changed by apache#10303
without any explicit mentions. i suppose it was a mistake.

see apache#8201 and referenced PRs
for previous discussions.
@acassis

acassis commented Dec 29, 2023

Copy link
Copy Markdown
Contributor

@yamt probably a mistake because for 32-bit he used uint32_t!

@xiaoxiang781216

xiaoxiang781216 commented Dec 30, 2023 •

Copy link
Copy Markdown
Contributor

@yamt #10303 is needed to pass LTP test case. From https://en.wikipedia.org/wiki/Unix_time, most POSIX OS(except 32bit QNX) define time_t to signed integer, so it's better to follow others choice to improve the compatibility with other POSIX implementation at least for 64bit time_t.

@xiaoxiang781216 xiaoxiang781216 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#10303 is to pass LTP test

@pkarashchenko

Copy link
Copy Markdown
Contributor

Is the LTP test a part of the CI run?

@pkarashchenko

pkarashchenko commented Dec 30, 2023 •

Copy link
Copy Markdown
Contributor

I mean, does the LTP test fail with unsigned 64-bit time_t as #10303 does not state anything about change from unsigned to signed, but is about moving type definitions into a proper file, so sign change there is not obvious.

@pkarashchenko pkarashchenko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Let's merge the change if the LTP test pass

@yamt

yamt commented Dec 30, 2023

Copy link
Copy Markdown
Contributor Author

@yamt #10303 is needed to pass LTP test case. From https://en.wikipedia.org/wiki/Unix_time, most POSIX OS(except 32bit QNX) define time_t to signed integer, so it's better to follow others choice to improve the compatibility with other POSIX implementation at least for 64bit time_t.

While I agree we can benefit from following the majority, IMO it's more important to be consistent within nuttx. Pros and cons have been discussed in the referenced PRs. It doesn't seem appropriate to revert it almost silently.

@xiaoxiang781216

xiaoxiang781216 commented Dec 30, 2023 •

Copy link
Copy Markdown
Contributor

@yamt #10303 is needed to pass LTP test case. From https://en.wikipedia.org/wiki/Unix_time, most POSIX OS(except 32bit QNX) define time_t to signed integer, so it's better to follow others choice to improve the compatibility with other POSIX implementation at least for 64bit time_t.

While I agree we can benefit from following the majority, IMO it's more important to be consistent within nuttx.

If you prefer consistent, I suggest changing 32bit time_t to signed.

Pros and cons have been discussed in the referenced PRs.

Compatibility is always top priority of NuttX design principle.

It doesn't seem appropriate to revert it almost silently.

The reason already highlights in #10303.
I am natural whether 64bit time_t is signed or unsigned before, that's why I merged #8201 after the discussion. But since #8201 break some LTP test case, now I prefer 64bit(or even 32bit) time_t to signed.

@xiaoxiang781216

Copy link
Copy Markdown
Contributor

Is the LTP test a part of the CI run?

We run LTP internally, and plan to enable it on github In 24Q1.

LGTM! Let's merge the change if the LTP test pass

No, LTP will break if we merging this patch.

@yamt

yamt commented Dec 30, 2023

Copy link
Copy Markdown
Contributor Author

@yamt #10303 is needed to pass LTP test case. From https://en.wikipedia.org/wiki/Unix_time, most POSIX OS(except 32bit QNX) define time_t to signed integer, so it's better to follow others choice to improve the compatibility with other POSIX implementation at least for 64bit time_t.

While I agree we can benefit from following the majority, IMO it's more important to be consistent within nuttx.

If you prefer consistent, I suggest changing 32bit time_t to signed.

as you know, 32 bit time_t overlaps too soon.

Pros and cons have been discussed in the referenced PRs.

Compatibility is always top priority of NuttX design principle.

in reality, i guess it depends on other factors as well.
otherwise, why has it been using unsigned time_t?

It doesn't seem appropriate to revert it almost silently.

The reason already highlights in #10303.

"highlights"? it actually didn't even mention the change at all.

I am natural whether 64bit time_t is signed or unsigned before, that's why I merged #8201 after the discussion. But since #8201 break some LTP test case, now I prefer 64bit(or even 32bit) time_t to signed.

ok, there is no problem with changing your mind.

what's wrong with disabling the "some LTP test case"?
i guess it's minor parts of it which actually assumes time_t type. isn't it the case?

@fxysunshine

Copy link
Copy Markdown
Contributor

I mean, does the LTP test fail with unsigned 64-bit time_t as #10303 does not state anything about change from unsigned to signed, but is about moving type definitions into a proper file, so sign change there is not obvious.

It's mistake. LTP case do not need change unsigned 64-bit time_t, only need define in <sys/types.h>.
https://github.com/linux-test-project/ltp/blob/master/testcases/open_posix_testsuite/conformance/definitions/time_h/7-3-buildonly.c

@pkarashchenko

Copy link
Copy Markdown
Contributor

@xiaoxiang781216 so which LTP test fails with this change? POSIX does not mandate time_t to be signed, so if the test case fails then LTP test case should be updated.

@xiaoxiang781216

Copy link
Copy Markdown
Contributor

@xiaoxiang781216 so which LTP test fails with this change? POSIX does not mandate time_t to be signed, so if the test case fails then LTP test case should be updated.

Ok, it's a false report as @fxysunshine reply here: #11466 (comment).

@xiaoxiang781216
xiaoxiang781216 merged commit 1ec63e1 into apache:master Dec 30, 2023
@yamt yamt mentioned this pull request Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants