diff --git a/docs/docs/installation.mdx b/docs/docs/installation.mdx index d314111d..17a0b0a2 100644 --- a/docs/docs/installation.mdx +++ b/docs/docs/installation.mdx @@ -234,8 +234,8 @@ Edit `$PROFILE` in your preferred PowerShell version and add the following lines $executionTime = -1 $history = Get-History -ErrorAction Ignore -Count 1 - if ($null -ne $history -and $null -ne $history.Duration) { - $executionTime = $history.Duration.TotalMilliseconds + if ($null -ne $history -and $null -ne $history.EndExecutionTime -and $null -ne $history.StartExecutionTime) { + $executionTime = ($history.EndExecutionTime - $history.StartExecutionTime).TotalMilliseconds } $startInfo = New-Object System.Diagnostics.ProcessStartInfo diff --git a/packages/powershell/oh-my-posh/oh-my-posh.psm1 b/packages/powershell/oh-my-posh/oh-my-posh.psm1 index 090f13b8..0a2930fd 100644 --- a/packages/powershell/oh-my-posh/oh-my-posh.psm1 +++ b/packages/powershell/oh-my-posh/oh-my-posh.psm1 @@ -74,8 +74,8 @@ function Set-PoshPrompt { $executionTime = -1 $history = Get-History -ErrorAction Ignore -Count 1 - if ($null -ne $history -and $null -ne $history.Duration) { - $executionTime = $history.Duration.TotalMilliseconds + if ($null -ne $history -and $null -ne $history.EndExecutionTime -and $null -ne $history.StartExecutionTime) { + $executionTime = ($history.EndExecutionTime - $history.StartExecutionTime).TotalMilliseconds } $startInfo = New-Object System.Diagnostics.ProcessStartInfo