Package jenkins.util
Class TimeDuration
java.lang.Object
jenkins.util.TimeDuration
Represents a length of something, like
3sec
.
This supports parameter injection, such as via QueryParameter
.- Since:
- 1.489
- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
static TimeDuration
fromString
(String delay) Creates aTimeDuration
from the delay passed in parameterint
getTime()
Deprecated.long
Returns the duration of this instance in milliseconds.int
Returns the duration of this instance in seconds.
-
Constructor Details
-
TimeDuration
public TimeDuration(long millis)
-
-
Method Details
-
getTime
Deprecated.usegetTimeInMillis()
instead. This method has always returned a time in milliseconds, when various callers incorrectly assumed seconds. And this spread through the codebase. So this has been deprecated for clarity in favour of more explicitly named methods.Returns the duration of this instance in milliseconds. -
getTimeInMillis
public long getTimeInMillis()Returns the duration of this instance in milliseconds. -
getTimeInSeconds
public int getTimeInSeconds()Returns the duration of this instance in seconds.- Since:
- 2.82
-
as
-
fromString
Creates aTimeDuration
from the delay passed in parameter- Parameters:
delay
- the delay either in milliseconds without unit, or in seconds if suffixed by sec or secs.- Returns:
- the TimeDuration created from the delay expressed as a String.
-
getTimeInMillis()
instead.