-
Notifications
You must be signed in to change notification settings - Fork 531
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
80 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#![allow(unreachable_pub)] | ||
// Bindings generated by `windows-bindgen` 0.49.0 | ||
#![allow(non_snake_case, non_upper_case_globals, non_camel_case_types, dead_code, clippy::all)] | ||
::windows_targets::link!("kernel32.dll" "system" fn SystemTimeToFileTime(lpsystemtime : *const SYSTEMTIME, lpfiletime : *mut FILETIME) -> BOOL); | ||
::windows_targets::link!("kernel32.dll" "system" fn SystemTimeToTzSpecificLocalTime(lptimezoneinformation : *const TIME_ZONE_INFORMATION, lpuniversaltime : *const SYSTEMTIME, lplocaltime : *mut SYSTEMTIME) -> BOOL); | ||
::windows_targets::link!("kernel32.dll" "system" fn TzSpecificLocalTimeToSystemTime(lptimezoneinformation : *const TIME_ZONE_INFORMATION, lplocaltime : *const SYSTEMTIME, lpuniversaltime : *mut SYSTEMTIME) -> BOOL); | ||
pub type BOOL = i32; | ||
#[repr(C)] | ||
pub struct FILETIME { | ||
pub dwLowDateTime: u32, | ||
pub dwHighDateTime: u32, | ||
} | ||
impl ::core::marker::Copy for FILETIME {} | ||
impl ::core::clone::Clone for FILETIME { | ||
fn clone(&self) -> Self { | ||
*self | ||
} | ||
} | ||
#[repr(C)] | ||
pub struct SYSTEMTIME { | ||
pub wYear: u16, | ||
pub wMonth: u16, | ||
pub wDayOfWeek: u16, | ||
pub wDay: u16, | ||
pub wHour: u16, | ||
pub wMinute: u16, | ||
pub wSecond: u16, | ||
pub wMilliseconds: u16, | ||
} | ||
impl ::core::marker::Copy for SYSTEMTIME {} | ||
impl ::core::clone::Clone for SYSTEMTIME { | ||
fn clone(&self) -> Self { | ||
*self | ||
} | ||
} | ||
#[repr(C)] | ||
pub struct TIME_ZONE_INFORMATION { | ||
pub Bias: i32, | ||
pub StandardName: [u16; 32], | ||
pub StandardDate: SYSTEMTIME, | ||
pub StandardBias: i32, | ||
pub DaylightName: [u16; 32], | ||
pub DaylightDate: SYSTEMTIME, | ||
pub DaylightBias: i32, | ||
} | ||
impl ::core::marker::Copy for TIME_ZONE_INFORMATION {} | ||
impl ::core::clone::Clone for TIME_ZONE_INFORMATION { | ||
fn clone(&self) -> Self { | ||
*self | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#![cfg(all(windows, feature = "clock", feature = "std"))] | ||
|
||
use std::fs::OpenOptions; | ||
use std::io::{Result, Write}; | ||
|
||
#[test] | ||
fn gen_bindings() -> Result<()> { | ||
let apis = [ | ||
"Windows.Win32.System.Time.SystemTimeToFileTime", | ||
"Windows.Win32.System.Time.SystemTimeToTzSpecificLocalTime", | ||
"Windows.Win32.System.Time.TzSpecificLocalTimeToSystemTime", | ||
]; | ||
|
||
let bindings = windows_bindgen::standalone(&apis); | ||
let mut file = | ||
OpenOptions::new().write(true).create(true).truncate(true).open("src/win_bindings.rs")?; | ||
file.write("#![allow(unreachable_pub)]\n".as_bytes())?; | ||
file.write(bindings.as_bytes())?; | ||
Ok(()) | ||
} |