Last active
February 17, 2020 03:25
-
-
Save aeppert/9243af222e1f47b44a62 to your computer and use it in GitHub Desktop.
Calculate elapsed time given two times
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export { | |
| type timeSpan: record { | |
| hours: int; | |
| minutes: int; | |
| seconds: int; | |
| }; | |
| } | |
| function calc_elapsed_time(t1: time, t2: time) : timeSpan | |
| { | |
| local ret: timeSpan; | |
| local timeInterval = double_to_count(time_to_double(t2) - time_to_double(t1)); | |
| ret$hours = (timeInterval / 3600); | |
| ret$minutes = (timeInterval - (ret$hours * 3600)) / 60; | |
| ret$seconds = (timeInterval % 60); | |
| return ret; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment