File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
library/std/src/sys/windows Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -199,6 +199,20 @@ if #[cfg(not(target_vendor = "uwp"))] {
199
199
}
200
200
}
201
201
202
+ #[ repr( C ) ]
203
+ pub struct SYSTEMTIME {
204
+ wYear : WORD ,
205
+ wMonth : WORD ,
206
+ wDayOfWeek : WORD ,
207
+ wDay : WORD ,
208
+ wHour : WORD ,
209
+ wMinute : WORD ,
210
+ wSecond : WORD ,
211
+ wMilliseconds : WORD ,
212
+ }
213
+
214
+ pub type LPSYSTEMTIME = * mut SYSTEMTIME ;
215
+
202
216
pub unsafe extern "system" fn WriteFileEx (
203
217
hFile : BorrowedHandle < ' _ > ,
204
218
lpBuffer : * mut :: core:: ffi:: c_void ,
@@ -407,6 +421,15 @@ compat_fn_with_fallback! {
407
421
pub fn GetProcessId ( handle: HANDLE ) -> DWORD {
408
422
rtabort!( "unavailable" )
409
423
}
424
+
425
+ // >= 95 / NT 3.5
426
+ // https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime
427
+ pub fn GetSystemTimeAsFileTime ( lpSystemTimeAsFileTime: LPFILETIME ) -> ( ) {
428
+ // implementation based on old MSDN docs
429
+ let mut st: SYSTEMTIME = crate :: mem:: zeroed( ) ;
430
+ GetSystemTime ( & mut st) ;
431
+ crate :: sys:: cvt( SystemTimeToFileTime ( & st, lpSystemTimeAsFileTime) ) . unwrap( ) ;
432
+ }
410
433
}
411
434
412
435
compat_fn_optional ! {
@@ -469,4 +492,7 @@ extern "system" {
469
492
) -> HANDLE ;
470
493
471
494
pub fn PulseEvent ( hEvent : HANDLE ) -> BOOL ;
495
+
496
+ pub fn GetSystemTime ( lpSystemTime : LPSYSTEMTIME ) ;
497
+ pub fn SystemTimeToFileTime ( lpSystemTime : * const SYSTEMTIME , lpFileTime : LPFILETIME ) -> BOOL ;
472
498
}
You can’t perform that action at this time.
0 commit comments