Time Strings¶
Often when tracking the progress of long-running code, it is useful to be able to access the current time, and convert a time in seconds into a more easily human readable format.
PrintCurrentTime¶
-
inline std::string
JSL::CurrentTime()¶ Get current system time in a readable format (note: was previously called PrintCurrentTime)
- Returns:
A string of the readable format
FormatDuration¶
-
inline std::string
JSL::FormatDuration(int timeInSeconds)¶ Given a duration in seconds, convert it into standard Day/Hour/Minute/Second formatted string. Times less than 1 second are reported as “less than 1 second”
- Parameters:
timeInSeconds – The time to be converted
- Returns:
A human-readable string equal to the input
FormatClock¶
-
inline std::string
JSL::FormatClock(std::chrono::time_point<std::chrono::system_clock> start, std::chrono::time_point<std::chrono::system_clock> end)¶ Calls FormatDuration() on the duration of the start and endpoints of a
chronostopwatch.- Parameters:
start – A
chronoobject representing the start of the durationend – The corresponding end-point
chrono