]>
git.proxmox.com Git - rustc.git/blob - vendor/sysinfo/src/windows/utils.rs
1 // Take a look at the license at the top of the repository in the LICENSE file.
3 use winapi
::shared
::minwindef
::FILETIME
;
4 use winapi
::um
::winnt
::LPWSTR
;
6 use std
::time
::SystemTime
;
9 pub(crate) fn filetime_to_u64(f
: FILETIME
) -> u64 {
10 (f
.dwHighDateTime
as u64) << 32 | (f
.dwLowDateTime
as u64)
14 pub(crate) fn get_now() -> u64 {
16 .duration_since(SystemTime
::UNIX_EPOCH
)
21 pub(crate) unsafe fn to_str(p
: LPWSTR
) -> String
{
31 let s
= std
::slice
::from_raw_parts(p
, i
as _
);
32 String
::from_utf16(s
).unwrap_or_else(|_e
| {
33 sysinfo_debug
!("Failed to convert to UTF-16 string: {}", _e
);