Skip to content

Commit 9e581bb

Browse files
committed
uefi-raw: add time feature and integration with time crate
By adding a convenient integration with `OffsetDateTime` of the `time` crate, we make `Time` much more usable. This commit adds the helpers `to_offset_date_time()` and `to_offset_date_time_with_default_timezone()`: the latter helps to better cope with Time::UNSPECIFIED_TIMEZONE.
1 parent d16cfdf commit 9e581bb

File tree

5 files changed

+382
-0
lines changed

5 files changed

+382
-0
lines changed

Cargo.lock

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ rust-version = "1.88"
2323
bitflags = "2.0.0"
2424
log = { version = "0.4.5", default-features = false }
2525
ptr_meta = { version = "0.3.0", default-features = false, features = ["derive"] }
26+
time = { version = "0.3", default-features = false, features = [] }
2627
uguid = "2.2.1"
2728

2829
[patch.crates-io]

uefi-raw/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
- Added new type `SerialIoProtocolRevision`
1313
- Added new type `SerialIoProtocol_1_1` as companion for `SerialIoProtocol`
1414
that includes the `device_type_guid` parameter
15+
- Added the `time` feature which integrates `struct Time` closely with
16+
`OffsetDateTime` from the [time crate](https://crates.io/crates/time).
17+
- `Time::to_offset_date_time`
18+
- `Time::to_offset_date_time_with_default_timezone`
1519

1620
## Changed
1721
- Switched `*const Self` to `*mut Self` in `SerialIoProtocol::set_attributes()`

uefi-raw/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ rust-version = "1.85.1"
2020

2121
[dependencies]
2222
bitflags.workspace = true
23+
time = { workspace = true, optional = true }
2324
uguid.workspace = true
2425

26+
[features]
27+
default = ["time"]
28+
time = ["dep:time"]
29+
2530
[package.metadata.docs.rs]
2631
rustdoc-args = ["--cfg", "docsrs"]

0 commit comments

Comments
 (0)