Skip to content

Add POSIX support for platforms with native system clocks - #190

Open
NitrofMtl wants to merge 1 commit into
PaulStoffregen:masterfrom
NitrofMtl:master
Open

Add POSIX support for platforms with native system clocks#190
NitrofMtl wants to merge 1 commit into
PaulStoffregen:masterfrom
NitrofMtl:master

Conversation

@NitrofMtl

Copy link
Copy Markdown

Summary

Adds optional POSIX time support for platforms with a native system clock.

When POSIX time is available:

  • breakTime() uses gmtime()
  • makeTime() uses mktime()
  • now() uses the native time() value
  • setTime() updates the platform clock

The existing TimeLib synchronization logic is kept intact, and platforms without POSIX support continue to use the existing implementation.

Currently, the POSIX platform clock setter is implemented for Arduino Mbed. Other __NEWLIB__ platforms will receive a warning and need to provide their platform-specific setTime() implementation.

Tested on an Arduino Opta with the Arduino Mbed core, including setTime(), now(), makeTime(), and breakTime() round trips.

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.

1 participant