Represents a time delay with a specific value and unit TimeUnits.
The Delay class allows for creating and manipulating time delay representations using various time units from nanoseconds to hours.
// Create delays using different time unitsconst shortDelay = new Delay(500, TimeUnits.MILLISECONDS);const longDelay = new Delay(2, TimeUnits.HOURS);console.log(shortDelay.toString()); // Outputs: "500ms"console.log(longDelay.toString()); // Outputs: "2h" Copy
// Create delays using different time unitsconst shortDelay = new Delay(500, TimeUnits.MILLISECONDS);const longDelay = new Delay(2, TimeUnits.HOURS);console.log(shortDelay.toString()); // Outputs: "500ms"console.log(longDelay.toString()); // Outputs: "2h"
Static
Parses a docker compose duration (10s, 1m30s, 500ms).
10s
1m30s
500ms
Compound durations are collapsed into the smallest unit they mention, so 1m30s becomes 90s — a different spelling of the same duration.
90s
Represents a time delay with a specific value and unit TimeUnits.
Remarks
The Delay class allows for creating and manipulating time delay representations using various time units from nanoseconds to hours.
Example