Summary of the new feature/enhancement
While Start-Sleep -MilliSeconds offers fine-grained control over the sleep duration, it would be convenient not to have two switch parameters just to be able to effectively specify fractional seconds.
E.g., instead of:
Start-Sleep -MilliSeconds 1400
it would be nice to be able to write:
Start-Sleep 1.4 # wishful thinking; translate into 1,400 msecs.
This is in line with the sleep utility on macOS and Linux, which accepts fractional values (e.g., sleep 1.4)
Currently, fractional values are quietly converted to [int] values, which means that rounding is applied, which is not only obscure behavior, but behavior that existing code is unlikely to rely upon.
As an aside: Start-Sleep is misnamed and should be called Invoke-Sleep - see #3990.
Proposed technical implementation details (optional)
Change the data type of the -Seconds parameter from [int] to [double] and simply cast the internal conversion to milliseconds to (int).
Summary of the new feature/enhancement
While
Start-Sleep -MilliSecondsoffers fine-grained control over the sleep duration, it would be convenient not to have two switch parameters just to be able to effectively specify fractional seconds.E.g., instead of:
it would be nice to be able to write:
This is in line with the
sleeputility on macOS and Linux, which accepts fractional values (e.g.,sleep 1.4)Currently, fractional values are quietly converted to
[int]values, which means that rounding is applied, which is not only obscure behavior, but behavior that existing code is unlikely to rely upon.As an aside:
Start-Sleepis misnamed and should be calledInvoke-Sleep- see #3990.Proposed technical implementation details (optional)
Change the data type of the
-Secondsparameter from[int]to[double]and simply cast the internal conversion to milliseconds to(int).