Durationby Group Public on Friday July 10 2009 @ 10:16:34 (1/1 Points) |
|
| Language ↪Reference ✑ Reply ✓ Stick It ✗ Ditch It ⚐ Tag It |
A Duration is a type which represents a length of time. This time can be specified in multiple formats and can either be specific, or somewhat loose.
All situations in the code which require a duration, such as a timeout, date difference, or delay, are expecting the Duration type.
There are couple of exceptions such as the java standard properties like sun.net.client.defaultReadTimeout where the value is still specified in milliseconds.
Syntax
There are two manners in which a duration can be specified. Either the XML Schema manner or the simplified manner.
Simplified Manner
The simplified manner lets you quickly specify a number of milliseconds, seconds, or minutes. Only a single unit may be used and it specifies an exact duration.
This form is intended to specify shorter periods of times, typically for delays or timeouts.
# Express in seconds Sleep 10s # Express in minutes set %Email.Loop.Timeout% 4.5m # Express in milliseconds Checkpoint timeout %Timer% 350ms
Note that fractional values are allowed in any case. Though be aware that due limitations in Java, fractional millisecond values are not respected in all cases (such as durationComp→).
XML Schema
This mechanism follows the XML Schema definition↗ for a duration. It allows a full range of duration specification and is meant for larger time periods than the simple mechanism. Though not that they are interchangeable in all cases.
# is the date different greater than 10 days if (dateBinOp %DateA% - %DateB%) > P10D # Convert age to duration and compare Checkpoint durationComp P%Age%Y > P20Y # Create an expiration 1.5 months later set %Expire% as dateBinOp %Var:DateTime% + P1M15D
Be aware of the notes in durationComp→ with respect to the relation between, for example, one month and 30 days.
TestPlan Duration
