mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 11:07:44 +00:00
uucore: fix uptime on Windows
This commit is contained in:
parent
3243fbaa03
commit
b1fc601cf8
4 changed files with 2 additions and 8 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -3439,7 +3439,6 @@ dependencies = [
|
||||||
"thiserror 2.0.12",
|
"thiserror 2.0.12",
|
||||||
"utmp-classic",
|
"utmp-classic",
|
||||||
"uucore",
|
"uucore",
|
||||||
"windows-sys 0.59.0",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -25,12 +25,6 @@ uucore = { workspace = true, features = ["libc", "utmpx", "uptime"] }
|
||||||
[target.'cfg(target_os = "openbsd")'.dependencies]
|
[target.'cfg(target_os = "openbsd")'.dependencies]
|
||||||
utmp-classic = { workspace = true }
|
utmp-classic = { workspace = true }
|
||||||
|
|
||||||
[target.'cfg(target_os="windows")'.dependencies]
|
|
||||||
windows-sys = { workspace = true, features = [
|
|
||||||
"Win32_System_RemoteDesktop",
|
|
||||||
"Wdk_System_SystemInformation",
|
|
||||||
] }
|
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "uptime"
|
name = "uptime"
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
|
@ -75,6 +75,7 @@ windows-sys = { workspace = true, optional = true, default-features = false, fea
|
||||||
"Win32_Storage_FileSystem",
|
"Win32_Storage_FileSystem",
|
||||||
"Win32_Foundation",
|
"Win32_Foundation",
|
||||||
"Win32_System_RemoteDesktop",
|
"Win32_System_RemoteDesktop",
|
||||||
|
"Win32_System_SystemInformation",
|
||||||
"Win32_System_WindowsProgramming",
|
"Win32_System_WindowsProgramming",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ pub fn get_uptime(_boot_time: Option<time_t>) -> UResult<i64> {
|
||||||
if uptime < 0 {
|
if uptime < 0 {
|
||||||
Err(UptimeError::SystemUptime)?;
|
Err(UptimeError::SystemUptime)?;
|
||||||
}
|
}
|
||||||
Ok(uptime as i64)
|
Ok(uptime as i64 / 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the system uptime in a human-readable format
|
/// Get the system uptime in a human-readable format
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue