-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Make Start-Sleep accept fractional seconds #8477
Copy link
Copy link
Closed
softagram/PowerShell
#6Labels
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-FixedThe issue is fixed.The issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module
Metadata
Metadata
Assignees
Labels
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-FixedThe issue is fixed.The issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module
Type
Fields
Give feedbackNo fields configured for issues without a type.
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).