Crates.io | gba_clock |
lib.rs | gba_clock |
version | 0.4.0 |
source | src |
created_at | 2023-08-28 01:34:35.123321 |
updated_at | 2024-06-17 19:11:57.903642 |
description | A real-time clock library for the GBA. |
homepage | |
repository | https://github.com/Anders429/gba_clock |
max_upload_size | |
id | 956532 |
size | 101,048 |
A real-time clock library for the GBA.
Provides access to the RTC for programs running on a Game Boy Advance, returning dates and times that are interoperable with the time
library.
time
's large-dates
feature is enabled).serde
library (by enabling the serde
feature).Access to the RTC is done through the Clock
type. Create a Clock
using the current time and use the returned instance to access the current time.
use gba_clock::Clock;
use time::{
Date,
Month,
PrimitiveDateTime,
Time,
};
let current_time = PrimitiveDateTime::new(
Date::from_calendar_date(2001, Month::March, 21).expect("invalid date"),
Time::from_hms(11, 30, 0).expect("invalid time"),
);
let clock = Clock::new(current_time).expect("could not communicate with the RTC");
// Read the current time whenever you need.
let time = clock
.read_datetime()
.expect("could not read the current time");
This project is licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.