feat: execution time for powershell 5

This commit is contained in:
TravisTX 2020-12-19 06:03:51 -07:00 committed by Jan De Dobbeleer
parent 85b1fc2662
commit 21f01d69e8
2 changed files with 4 additions and 4 deletions

View file

@ -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

View file

@ -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