Cody

Problem 786. Top of the Hour : Return from your routine within 1 second of the hour

Solution 1569608

Submitted on 26 Jun 2018
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   Fail
format long format compact datestr(now) x=Top_of_Hour; y=now; datestr(y) mmss_dec=rem(y*24,1) % hh:59:59 is 0.99972 Pass=0; if mmss_dec<2/3600,Pass=1;end % 2 second threshold assert(Pass==1,sprintf('%s',datestr(y)))

ans = '26-Jun-2018 16:00:30' ans = '26-Jun-2018 16:00:31' mmss_dec = 0.008642949163914

26-Jun-2018 16:00:31

Suggested Problems

More from this Author241

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!