A task for sleeping a short period of time, useful when a build or deployment process requires an interval between tasks.


Attribute Description Required
hours hours to to add to the sleep time No
minutes minutes to add to the sleep time No
seconds seconds to add to the sleep time No
milliseconds milliseconds to add to the sleep time No
failonerror flag controlling whether to break the build on an error No

The sleep time is the sum of specified values, hours, minutes seconds and milliseconds. A negative value can be supplied to any of them provided the total sleep time is positive

Note that sleep times are always hints to be interpreted by the OS how it feels—small times may either be ignored or rounded up to a minimum timeslice. Note also that the system clocks often have a fairly low granularity too, which complicates measuring how long a sleep actually took.


Sleep for about 10 ms.

<sleep milliseconds="10"/>

Sleep for about 2 seconds.

<sleep seconds="2"/>

Sleep for one hour less 59:58, or two seconds again.

<sleep hours="1" minutes="-59" seconds="-58"/>

Sleep for no time at all. This may yield the CPU time to another thread or process.