| timeFormater {SimDesign} | R Documentation |
Format time string to suitable numeric output
Description
Format time input string into suitable numeric output metric (e.g., seconds).
Input follows the SBATCH utility specifications.
Accepted time formats include "minutes",
"minutes:seconds", "hours:minutes:seconds",
"days-hours", "days-hours:minutes" and
"days-hours:minutes:seconds".
Usage
timeFormater(time, output = "sec")
Arguments
time |
a character string to be formatted. If a numeric vector is supplied then this will be interpreted as seconds. |
output |
type of numeric output to convert time into.
Currently supported are |
Details
For example, max_time = "60" indicates a maximum time of 60 minutes,
max_time = "03:00:00" a maximum time of 3 hours,
max_time = "4-12" a maximum of 4 days and 12 hours, and
max_time = "2-02:30:00" a maximum of 2 days, 2 hours and 30 minutes.
Examples
# Test cases (outputs in seconds)
timeFormater("4-12") # day-hours
timeFormater("4-12:15") # day-hours:minutes
timeFormater("4-12:15:30") # day-hours:minutes:seconds
timeFormater("30") # minutes
timeFormater("30:30") # minutes:seconds
timeFormater("4:30:30") # hours:minutes:seconds
# output in hours
timeFormater("4-12", output = 'hour')
timeFormater("4-12:15", output = 'hour')
timeFormater("4-12:15:30", output = 'hour')
timeFormater("30", output = 'hour')
timeFormater("30:30", output = 'hour')
timeFormater("4:30:30", output = 'hour')