mirror of
https://github.com/nushell/nushell.git
synced 2025-08-14 23:22:32 +02:00
add more ps
columns in Windows (#10275)
# Description This PR adds a few more columns to `ps -l` on Windows. It would be good to add these changes cross-platform in separate PRs. This PR also fixes a bug where start time was calculated wrong. I've added: start_time user user_sid priority  # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use std testing; testing run-tests --path crates/nu-std"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. -->
This commit is contained in:
@ -135,9 +135,11 @@ pub fn collect_proc(interval: Duration, _with_thread: bool) -> Vec<ProcessInfo>
|
||||
let io = get_io(handle);
|
||||
|
||||
let start_time = if let Some((start, _, _, _)) = times {
|
||||
// 11_644_473_600 is the number of seconds between the Windows epoch (1601-01-01) and
|
||||
// the Linux epoch (1970-01-01).
|
||||
let time = chrono::Duration::seconds(start as i64 / 10_000_000);
|
||||
let base =
|
||||
NaiveDate::from_ymd_opt(1600, 1, 1).and_then(|nd| nd.and_hms_opt(0, 0, 0));
|
||||
NaiveDate::from_ymd_opt(1601, 1, 1).and_then(|nd| nd.and_hms_opt(0, 0, 0));
|
||||
if let Some(base) = base {
|
||||
let time = base + time;
|
||||
Local.from_utc_datetime(&time)
|
||||
@ -146,7 +148,7 @@ pub fn collect_proc(interval: Duration, _with_thread: bool) -> Vec<ProcessInfo>
|
||||
}
|
||||
} else {
|
||||
let time =
|
||||
NaiveDate::from_ymd_opt(1600, 1, 1).and_then(|nt| nt.and_hms_opt(0, 0, 0));
|
||||
NaiveDate::from_ymd_opt(1601, 1, 1).and_then(|nt| nt.and_hms_opt(0, 0, 0));
|
||||
if let Some(time) = time {
|
||||
Local.from_utc_datetime(&time)
|
||||
} else {
|
||||
@ -775,6 +777,7 @@ fn get_io(handle: HANDLE) -> Option<(u64, u64)> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct SidName {
|
||||
pub sid: Vec<u64>,
|
||||
pub name: Option<String>,
|
||||
|
Reference in New Issue
Block a user