Cody

# Problem 62. Elapsed Time

Solution 2681759

Submitted on 12 Jul 2020 by Carson Foy
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
d1 = '2010/12/14 12:00:00'; d2 = '2010/12/17 17:06:00'; elapsed = 77.1; assert(abs(elapsed_time(d1,d2) - elapsed) < 1e-6)

elapsed = '77h 6m 0s' temp = 1 3 hours = 77 temp = 5 6 minutes = 6 temp = 8 9 seconds = 0 elapsed = 77.099999999999994

2   Pass
d1 = '2010/12/14 12:00:00'; d2 = '2010/12/14 12:00:01'; elapsed = 1/3600; assert(abs(elapsed_time(d1,d2) - elapsed) < 1e-6)

elapsed = '0h 0m 1s' temp = 1 2 hours = 0 temp = 4 5 minutes = 0 temp = 7 8 seconds = 1 elapsed = 2.777777777777778e-04

3   Pass
d1 = '1924/1/7 12:45:00'; d2 = '2010/12/14 17:06:00'; elapsed = 762076.35; assert(abs(elapsed_time(d1,d2) - elapsed) < 1e-6)

elapsed = '762076h 21m 0s' temp = 1 7 hours = 762076 temp = 9 11 minutes = 21 temp = 13 14 seconds = 0 elapsed = 7.620763500000000e+05

4   Pass
d1 = '2010/12/14 12:00:00' d2 = '2010/12/14 13:06:36' elapsed = 1.11; assert(abs(elapsed_time(d1,d2) - elapsed) < 1e-6)

d1 = '2010/12/14 12:00:00' d2 = '2010/12/14 13:06:36' elapsed = '1h 6m 36s' temp = 1 2 hours = 1 temp = 4 5 minutes = 6 temp = 7 9 seconds = 36 elapsed = 1.110000000000000