8000 Use `Environment.TickCount64` in `GetUptimeCommand` by xtqqczze · Pull Request #26151 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Conversation

xtqqczze
Copy link
Contributor
@xtqqczze xtqqczze commented Oct 5, 2025
  • Use the .NET Core 3.0 API Environment.TickCount64 instead of Stopwatch.
  • Refactor into seperate methods for the different code paths.

cc: @iSazonov

Use the .NET Core 3.0 API `Environment.TickCount64` instead of `Stopwatch`
@iSazonov
Copy link
Collaborator
iSazonov commented Oct 8, 2025

@xtqqczze This is more difficult area than might be expected.
See dotnet/runtime#77945
Really we could say about:

  1. absolute OS boot time
  2. how long OS works since boot time minus suspended time
  3. time from OS boot time to current time
    Ideally the cmdlet should allow users to get all these times.

@xtqqczze
Copy link
Contributor Author
xtqqczze commented Oct 8, 2025

@iSazonov Does dotnet/runtime#77945 mean these changes are a change in behavior?

@iSazonov
Copy link
Collaborator
iSazonov commented Oct 8, 2025

Yes, this should correct the difference on different systems.

@xtqqczze
Copy link
Contributor Author
xtqqczze commented Oct 8, 2025

So these changes are a fix for #18469?

@iSazonov
Copy link
Collaborator
iSazonov commented Oct 8, 2025

One step in this direction. What would be ideal, I described above.

@xtqqczze
Copy link
Contributor Author
xtqqczze commented Oct 8, 2025

The cmdlet is documented to "return the time elapsed since the last boot of the operating system"

So if these changes align with this, then I think that is sufficient for this PR.

how long OS works since boot time minus suspended time

This would be a new feature and could be implemented separately.

@iSazonov
Copy link
Collaborator
iSazonov commented Oct 9, 2025

This cmdlet was presented as an experimental one to get feedback. After some issues and user expectations have been identified, this cmdlet can be fixed as I described, but a fix in Runtime is required before.

@xtqqczze
Copy link
Contributor Author
xtqqczze commented Oct 9, 2025

This cmdlet was presented as an experimental one to get feedback. After some issues and user expectations have been identified, this cmdlet can be fixed as I described, but a fix in Runtime is required before.

I see there is now PR: dotnet/runtime#119443

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0