Sujet : Re: 32 bits time_t and Y2038 issue
De : news-1513678000 (at) *nospam* discworld.dascon.de (Michael Schwingen)
Groupes : comp.arch.embeddedDate : 15. Mar 2025, 17:30:21
Autres entêtes
Message-ID : <slrnvtbaot.sal.news-1513678000@a-tuin.ms.intern>
References : 1 2
User-Agent : slrn/1.0.3 (Linux)
On 2025-03-11, David Brown <
david.brown@hesbynett.no> wrote:
package as-is. For anything other than a quick demo, my preferred setup
is using makefiles for the build along with an ARM gcc toolchain. That
way I can always build my software, from any system, and archive the
toolchain. (One day, I will also try using clang with these packages,
but I haven't done so yet.)
Same here. I just switched to ARM gcc + picolibc for all my ARM projects -
this required some changes in the way my makefiles generate linker scripts
and startup code, and now I am quite happy with that setup.
I have one project where I needed custom time functions: a nixie clock that
has both a RTC (with seconds/minutes/... registers), and NTP to get current
time. NTP time is seconds since 1.1.1900 and UTC.
The sane approach to handling timezones and DST is the unix way: keep
everything in UTC internally and convert to localtime when displaying the
time. To set the RTC, that requires a version of mktime that does *not* do
timezone conversion - I simply pulled mktime from the newlib sources and
removed the timezone stuff - done. You could write that stuff yourself, but
getting all the corner cases right will take some time. The existing code
is there and works fine.
cu
Michael
-- Some people have no respect of age unless it is bottled.