It's fairly simple to time a block of code using `Measure-Command`, `[system.diagnostics.stopwatch]` or by diffing a couple of `Get-Date` calls, but here's the weird thing;

When I wrap `Measure-Command` with two date objects, sometimes `Measure-Command.TotalMilliseconds` is longer than `($EndTime - $StartTime).TotalMilliSeconds`.

Is the `$EndTime` object being instantiated before `Measure-Command` finishes? 

Why does this still happen if I run single-threaded; `powershell.exe -sta`?

Is there any way to force `$EndTime` to be set after `Measure-Command` ends?

Is there any guarantee `StartTime` has been created before `Measure-Command`? 

Clearly this particular method is not a sensible way to evaluate code execution time.

```
$Stopwatch = [system.diagnostics.stopwatch]::startNew() 
$mc =Measure-Command{Invoke-WebRequest -Uri "http://www.google.com" -Method Head}
$Stopwatch.stop()

$mc.TotalMilliseconds
$Stopwatch.Elapsed.TotalMilliSeconds
"="
 $Stopwatch.Elapsed.TotalMilliSeconds - $mc.TotalMilliseconds

"`n"

$StartTime = (get-Date)
$mc = Measure-Command{Invoke-WebRequest -Uri "http://www.google.com" -Method Head}
$EndTime = (get-Date)

$mc.TotalMilliseconds
($EndTime - $StartTime).TotalMilliSeconds
"="
($EndTime - $StartTime).TotalMilliSeconds - $mc.TotalMilliseconds #This should never be negative but sometimes it is.

"`n"

$mc1 =Measure-Command{$mc2 = Measure-Command{Invoke-WebRequest -Uri "http://www.google.com" -Method Head}}

$mc1.TotalMilliseconds - $mc2.TotalMilliseconds 

```

Example output

```
122.3065
122.4322
=
0.125700000000009

142.8695
140.6371
=
-2.23240000000001

0.104199999999992

```