File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed
Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 11# uefi - [ Unreleased]
22
3+ ## Added
4+ - Added ` Timestamp ` protocol.
5+
36# uefi - 0.27.0 (2024-03-17)
47
58## Added
Original file line number Diff line number Diff line change 1+ //! Miscellaneous protocols.
2+
3+ use crate :: proto:: unsafe_protocol;
4+ use crate :: { Result , StatusExt } ;
5+ use uefi_raw:: protocol:: misc:: { TimestampProperties , TimestampProtocol } ;
6+
7+ /// Protocol for retrieving a high-resolution timestamp counter.
8+ #[ derive( Debug ) ]
9+ #[ repr( transparent) ]
10+ #[ unsafe_protocol( TimestampProtocol :: GUID ) ]
11+ pub struct Timestamp ( TimestampProtocol ) ;
12+
13+ impl Timestamp {
14+ /// Get the current value of the timestamp counter.
15+ #[ must_use]
16+ pub fn get_timestamp ( & self ) -> u64 {
17+ unsafe { ( self . 0 . get_timestamp ) ( ) }
18+ }
19+
20+ /// Get the properties of the timestamp counter.
21+ pub fn get_properties ( & self ) -> Result < TimestampProperties > {
22+ let mut properties = TimestampProperties :: default ( ) ;
23+ unsafe { ( self . 0 . get_properties ) ( & mut properties) } . to_result_with_val ( || properties)
24+ }
25+ }
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ pub mod device_path;
7272pub mod driver;
7373pub mod loaded_image;
7474pub mod media;
75+ pub mod misc;
7576pub mod network;
7677pub mod pi;
7778pub mod rng;
You can’t perform that action at this time.
0 commit comments