util/time.sh¶
Util time related functions.
- time_duration_w()¶
Prints duration to execute the given command.
- Parameters:
marker – Marker for the log line.
... – Command to run and arguments.
- Returns:
Output of the command plus log line with duration in ms.
- Return type:
string
- time_millis_to_date()¶
Return date format for the given number in milliseconds.
- Parameters:
millis – Time in milliseconds.
- Returns:
Date format.
- Return type:
string
- time_millis_to_seconds()¶
Convert milliseconds to seconds.
- Parameters:
millis – Time in milliseconds.
- Returns:
Time in seconds.
- Return type:
int
- time_month_to_num()¶
Convert month (as a string) to number.
- Parameters:
str – Month as a string (short or long).
- Returns:
Month as a number (Jan=1).
- Return type:
int
- time_now_day_of_month()¶
Current day of the month.
- Returns:
Current day of the month.
- Return type:
int
- time_now_day_of_week()¶
Current day of the week (as a number: 1-Mon, … 7-Sun).
- Returns:
Current day of the week as a number.
- Return type:
int
- time_now_day_of_week_str()¶
Current day of the week (as a string: Monday, … Sunday).
- Returns:
Current day of the week as a string.
- Return type:
string
- time_now_iso8601()¶
Current time in ISO 8601 format.
- Returns:
Current time in ISO 8601 format.
- Return type:
string
- time_now_millis()¶
Current time in milliseconds.
- Returns:
Current time in milliseconds.
- Return type:
int
- time_now_month()¶
Current month (as a number).
- Returns:
Current month as a number.
- Return type:
int
- time_now_month_str()¶
Current month (as a full string, e.g., January).
- Returns:
Current month as a string.
- Return type:
string
- time_now_year()¶
Current year.
- Returns:
Current year.
- Return type:
int
- time_num_to_month()¶
Convert a number to month string.
- Parameters:
num – Month as a number (Jan=1).
- Returns:
Short month string.
- Return type:
string
- time_seconds_to_date()¶
Convert from seconds to date format.
- Parameters:
secs – Time in seconds.
- Returns:
Date format.
- Return type:
string