File tree 3 files changed +28
-0
lines changed
3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 1
1
# uefi - [ Unreleased]
2
2
3
+ ## Added
4
+ - Added ` Timestamp ` protocol.
5
+
3
6
# uefi - 0.27.0 (2024-03-17)
4
7
5
8
## 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
+ pub fn get_timestamp ( & self ) -> u64 {
16
+ unsafe { ( self . 0 . get_timestamp ) ( ) }
17
+ }
18
+
19
+ /// Get the properties of the timestamp counter.
20
+ pub fn get_properties ( & self ) -> Result < TimestampProperties > {
21
+ let mut properties = TimestampProperties :: default ( ) ;
22
+ unsafe { ( self . 0 . get_properties ) ( & mut properties) } . to_result_with_val ( || properties)
23
+ }
24
+ }
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ pub mod device_path;
72
72
pub mod driver;
73
73
pub mod loaded_image;
74
74
pub mod media;
75
+ pub mod misc;
75
76
pub mod network;
76
77
pub mod pi;
77
78
pub mod rng;
You can’t perform that action at this time.
0 commit comments