Skip to content

uefi: Add integration with crates jiff and time for struct Time#1911

Closed
phip1611 wants to merge 6 commits into
mainfrom
uefi-raw-time-v3
Closed

uefi: Add integration with crates jiff and time for struct Time#1911
phip1611 wants to merge 6 commits into
mainfrom
uefi-raw-time-v3

Conversation

@phip1611
Copy link
Copy Markdown
Member

This is my third design, superseding the outdated approaches #1896 and #1899.

Motivation

My high-level goal is to make struct Time more useable, e.g., compare dates (before, after, ...).

Design

This PR integrates struct Time of the uefi crate with https://crates.io/crates/time and https://crates.io/crates/jiff. I decided for the following design:

  • TryFrom and no specific constructors
  • Use the "datetime without timezone" and "datetime with timezone" types of the time libraries

Error

There is a single opaque ConversionError shared by all TryFrom impls.

Implementation

  • time crate

    • struct Time <--> PrimitiveDateTime (without timezone)
    • struct Time <--> OffsetDateTime (with timezone)
  • jiff crate

    • struct Time <--> DateTime (without timezone)
    • struct Time <--> Zoned (with timezone)

@phip1611
Copy link
Copy Markdown
Member Author

@nicholasbishop thanks for your valuable review and feedback in #1896 and #1899. I think we are now the closest to have something useful and mergable. Looking forward to your feedback!

@phip1611 phip1611 force-pushed the uefi-raw-time-v3 branch 3 times, most recently from f9b11f2 to 0534af3 Compare March 21, 2026 15:34
Copy link
Copy Markdown
Member

@nicholasbishop nicholasbishop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good to me, but I haven't reviewed in detail yet. Let's break it apart some. I think start with a new PR to move the Time stuff to a new module like uefi::runtime::time, then a PR to add time, then jiff.

Comment thread uefi/src/runtime/mod.rs Outdated
Comment thread uefi/src/runtime/mod.rs Outdated
Comment thread uefi/src/runtime/mod.rs Outdated
@phip1611 phip1611 self-assigned this May 31, 2026
@phip1611 phip1611 force-pushed the uefi-raw-time-v3 branch from 0534af3 to 3490870 Compare June 1, 2026 06:49
@phip1611 phip1611 marked this pull request as draft June 1, 2026 06:58
phip1611 added 6 commits June 1, 2026 11:42
This module provides the foundational plumbing for future time-related
crate integrations. It introduces common error types, including a
unified opaque ConversionError to standardize conversion failures across
crates.

While integration with crates like time and jiff is planned in
subsequent commits, this module lays the groundwork, ensuring a
consistent and minimal API for handling errors once those integrations
are implemented.
@phip1611 phip1611 force-pushed the uefi-raw-time-v3 branch from 3490870 to d065d8d Compare June 1, 2026 09:42
@phip1611 phip1611 marked this pull request as ready for review June 1, 2026 09:42
@phip1611 phip1611 requested a review from nicholasbishop June 1, 2026 09:42
@phip1611 phip1611 closed this Jun 1, 2026
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.

2 participants