Thank you, Greg, for doing this research and putting this all together here!
This stood out (replying below): On Wed, Nov 6, 2024 at 8:11 AM Gregory Nutt <spudan...@gmail.com> wrote: > * Linux <https://en.wikipedia.org/wiki/Linux> originally used a 64-bit > |time_t| for 64-bit architectures only; the pure 32-bit ABI > <https://en.wikipedia.org/wiki/Application_binary_interface> was not > changed due to backward compatibility.^[20] > > <https://en.wikipedia.org/wiki/Year_2038_problem#cite_note-Pondering2038-22> > Starting with version 5.6 > > <https://en.wikipedia.org/wiki/Linux_kernel_version_history#Releases_5.x.y> > of 2020, 64-bit |time_t| is supported on 32-bit architectures, too. > This was done primarily for the sake of embedded Linux > <https://en.wikipedia.org/wiki/Linux_on_embedded_systems> > systems.^[21] So, Linux (since 5.6) uses 64-bit time_t on 32-bit archs -- emphasis on "primarily for the sake of embedded Linux systems" -- It sounds like that was done because embedded systems are expected to function in machinery, infrastructure, etc., things that are long-lived. This is exactly my experience with embedded systems. So we need to be mindful of Year 2038 problems. I'd like to also reply to raiden00pl: On Wed, Nov 6, 2024 at 6:20 AM raiden00pl <raiden0...@gmail.com> wrote: > > Unconditional int64_t time_t is a waste of resources for small systems. > Easier porting of *some* applications for *some* users at the expense of > other users is not the solution. > Nuttx has a lot of options anyway and that is nothing more than a > consequence of `INVIOLABLES.md`. > For some people this is a disadvantage, for others it's a great opportunity > to fine tune their system. > Kconfig with choices, as Tomek says, seems like a good option to me. Next > we can make the default > value dependent on DEFAULT_SMALL. But whether the default 32 bit time > should be signed or unsigned, > I have no opinion. This is very similar to my thoughts. It is good that we have Kconfig and developers can fine-tune their systems to their needs and constraints. In general, I think our defaults should make it as easy as possible to get up-and-running, but we should give developers options (through Kconfig) because they know best what they are trying to achieve with NuttX. I am +1 for a Kconfig. I am okay with any of these possibilities: * make the default depend on DEFAULT_SMALL like raiden00pl suggests * or make the default 64-bit on all 32-bit and 64-bit systems and 32-bit on all 8-bit and 16-bit systems * or just make the default 64-bit on ALL systems, and if you are trimming resources, you can make a judgment call whether to reduce it to 32-bit Example where it makes sense to reduce time_t, even though Year 2038 problem: a toaster with a 8-bit MCU. As long as you implement time comparisons to work correctly through rollover, your bread will come out toasted correctly! Same for coffee maker, dishwasher, etc. Cheers, Nathan