raspberrypi: stop pulling newlib's time zone code into RP2040 builds - #11379
Merged
Merged
Conversation
The SDK's pico_localtime_r() and pico_mktime() are weak wrappers around newlib's localtime_r() and mktime(). rtc.RTC uses them through aon_timer on RP2040, and they bring tzset, getenv and the scanf code along: 6496 bytes of flash on raspberry_pi_pico. CircuitPython has the same calendar arithmetic in shared/timeutils, and newlib runs without a TZ here, so both compute UTC. Define the two SDK hooks on top of timeutils. RP2350 keeps its time in the powman timer and never called them.
dhalbert
approved these changes
Sep 14, 2026
dhalbert
left a comment
Collaborator
There was a problem hiding this comment.
OH, neat! This is a big savings!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The SDK's
pico_localtime_r()andpico_mktime()are weak wrappers around newlib'slocaltime_r()andmktime().rtc.RTCuses them through aon_timer on RP2040, and they bring tzset, getenv and the scanf code along.CircuitPython has the same calendar arithmetic in
shared/timeutils, and newlib runs without a TZ here, so both compute UTC.This PR defines the two SDK hooks on top of timeutils.
Flash on raspberry_pi_pico: 981080 -> 974584, saved 6.5 kB.