Cody

Solution 1867436

Submitted on 7 Jul 2019 by Emma Moore
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)

dates = 2×1 datetime array 14-Dec-2010 12:00:00 17-Dec-2010 17:06:00 n = 0 0 0 77 6 0 hrfrac1 = 0.1000 hrfrac2 = 0 elapsed = 77.1000

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)

dates = 2×1 datetime array 14-Dec-2010 12:00:00 14-Dec-2010 12:00:01 n = 0 0 0 0 0 1 hrfrac1 = 0 hrfrac2 = 2.7778e-04 elapsed = 2.7778e-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)

d1 = '1924/01/7 12:45:00' d1 = '1924/01/07 12:45:00' dates = 2×1 datetime array 07-Jan-1924 12:45:00 14-Dec-2010 17:06:00 n = 0 0 0 762076 21 0 hrfrac1 = 0.3500 hrfrac2 = 0 elapsed = 7.6208e+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' dates = 2×1 datetime array 14-Dec-2010 12:00:00 14-Dec-2010 13:06:36 n = 0 0 0 1 6 36 hrfrac1 = 0.1000 hrfrac2 = 0.0100 elapsed = 1.1100