1
Fork 0
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:
Bluemangoo 2025-03-10 17:58:08 +08:00
parent 3243fbaa03
commit b1fc601cf8
No known key found for this signature in database
GPG key ID: F2F7E46880A1C4CF
4 changed files with 2 additions and 8 deletions

1
Cargo.lock generated
View file

@ -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]]

View file

@ -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"

View file

@ -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",
] } ] }

View file

@ -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