Skip to content

Use Environment.TickCount64 in GetUptimeCommand#26151

Closed
xtqqczze wants to merge 3 commits intoPowerShell:masterfrom
xtqqczze:GetUptimeCommand-TickCount64
Closed

Use Environment.TickCount64 in GetUptimeCommand#26151
xtqqczze wants to merge 3 commits intoPowerShell:masterfrom
xtqqczze:GetUptimeCommand-TickCount64

Conversation

@xtqqczze
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

xtqqczze commented Oct 8, 2025

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

@iSazonov
Copy link
Copy Markdown
Collaborator

iSazonov commented Oct 8, 2025

Yes, this should correct the difference on different systems.

@xtqqczze
Copy link
Copy Markdown
Contributor Author

xtqqczze commented Oct 8, 2025

So these changes are a fix for #18469?

@iSazonov
Copy link
Copy Markdown
Collaborator

iSazonov commented Oct 8, 2025

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

@xtqqczze
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

@microsoft-github-policy-service microsoft-github-policy-service bot added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Oct 12, 2025
@xtqqczze
Copy link
Copy Markdown
Contributor Author

Waiting on dotnet/runtime#119443

@microsoft-github-policy-service microsoft-github-policy-service bot removed Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept Stale labels Oct 27, 2025
@iSazonov
Copy link
Copy Markdown
Collaborator

I suggest to close the PR because we need not only update from .Net but also we should redesign the cmdlet based on feedback we got in last years.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Oct 31, 2025
@xtqqczze
Copy link
Copy Markdown
Contributor Author

xtqqczze commented Nov 4, 2025

Waiting on dotnet/runtime#119443

It does not look like this will be happening anytime soon.

@microsoft-github-policy-service microsoft-github-policy-service bot added Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept and removed Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept labels Nov 4, 2025
@microsoft-github-policy-service
Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 15 days. It will be closed if no further activity occurs within 10 days of this comment.

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

Labels

Stale Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants