Powershell: Get-Uptime on 2020 MacBook Pro (MacBookPro16,2) reports incorrect times

Created on 3 Aug 2020  Â·  5Comments  Â·  Source: PowerShell/PowerShell

Steps to reproduce

Issue Get-Uptime
Compare to bash uptime and macOS System Information

Expected behavior

Get-Uptime should match macOS System Information time and bash uptime output

Actual behavior

Get-Uptime on 2020 MacBook Pro (MacBookPro16,2) reports random, incorrect time. This does _not_ occur on a 2019 iMac (iMac19,1) running the same version of macOS 10.15.6

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.3
PSEdition                      Core
GitCommitId                    7.0.3
OS                             Darwin 19.6.0 Darwin Kernel Version 19.6.0: Sun…
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

IncorrectGet-Uptime

Area-Cmdlets-Utility Issue-Bug Waiting - DotNetCore

All 5 comments

We use Stopwatch.GetTimestamp() / Stopwatch.Frequency to get seconds from system startup. So it is .Net issue.

You could create a simple C# repro and open new issue in .Net Runtime repository. Thanks!

/cc @SteveL-MSFT

If it's the .Net class that's a problem, fine. But I don't use it directly -- I use the PowerShell cmdlet, so AFAIAC, it's a PowerShell issue.

Great! But if the underlying API is causing it, we aren't in a position to really fix it, unless there happen to be alternative APIs we're able to utilise. 🙂

I'm not aware of any alternatives atm though.

Could you please check with latest PowerShell 7.1 Preview build?

@steveisok @vargaz Make sense to open new issue about Stopwatch.GetTimestamp() / Stopwatch.Frequency in .Net Runtime repository?

Was this page helpful?
0 / 5 - 0 ratings