Improve RTC support, implement RTC write command#205
Merged
sp1187 merged 2 commits inton64dev:masterfrom Sep 4, 2021
Merged
Conversation
* Set local time offset when writing to Joybus or 64DD RTC. * Refactor get_local_time to use ISO C Time APIs. Special thanks to @jago85 and @LuigiBlood for their research!
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 Joybus commands to read/write to RTC are based off of the UltraPIF implementation (thanks @jago85!)
The N64DD commands to read/write to RTC are based off of LuigiBlood's research (thanks @LuigiBlood)
Note that RTC writes are currently not persistent after the emulator quits and will always revert to system local time on the next launch.
Changes to
get_local_timeget_local_timenow supports an offset (in seconds) so that the RTC clock can be adjusted relative to local time.Note that the implementation of getting the operating system time has been unified using ISO C Time functions; I have made a best-effort to implement this for Windows but I do not run Windows so I have not tested it. I would greatly appreciate it if a Windows user could build this and run my test ROM.
Test ROM
rtctest.zip (For more information about this test ROM, please see DragonMinded/libdragon#152)
Note that the test ROM does not currently support the N64DD RTC, you can test reading/writing to the 64DD RTC using the DD IPL ROM (holding down A while booting).