Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RTC device file #400

Merged
merged 5 commits into from
Aug 28, 2022
Merged

Add RTC device file #400

merged 5 commits into from
Aug 28, 2022

Conversation

vinc
Copy link
Owner

@vinc vinc commented Aug 28, 2022

  • Add a device file for the RTC at /dev/rtc
  • Allow writing to the device to change the date and time

@vinc
Copy link
Owner Author

vinc commented Aug 28, 2022

> read /dev/rtc
2022-08-28 09:23:21

> lisp
MOROS Lisp v0.3.0

> (load "/lib/lisp/core.lsp")
true

> (read-file "/dev/rtc")
"2022-08-28 09:24:47"

@vinc
Copy link
Owner Author

vinc commented Aug 28, 2022

Some RTC have a century register at 0x32 but it could be at another port defined in an ACPI table. It can also be absent, or worse, wrong. I experimented with it but had issues with dates in future centuries.

For now dates should be between the beginning of 2000 and the end of 2099:

> print "2099-12-31 23:59:57" => /dev/rtc

> date
2099-12-31 23:59:58 +0000

> date
2099-12-31 23:59:59 +0000

> date
2000-01-01 00:00:00 +0000

Hopefully we'll have a better system by the end of the century :)

@vinc vinc marked this pull request as ready for review August 28, 2022 15:25
@vinc vinc merged commit e1be971 into trunk Aug 28, 2022
@vinc vinc deleted the feature/rtc-device-file branch August 28, 2022 16:40
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