Cody

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

Solution 1331864

Submitted on 8 Nov 2017 by David Verrelli
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
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 = '08-Nov-2017 13:59:49' s = 49.665236999999998 s = 50.165874000000002 s = 50.666491999999998 s = 51.167105999999997 s = 51.669409000000002 s = 52.170118000000002 s = 52.670374000000002 s = 53.170642000000001 s = 53.670883000000003 s = 54.171132999999998 s = 54.671424999999999 s = 55.171675000000000 s = 55.672088000000002 s = 56.172381999999999 s = 56.672680000000000 s = 57.172975999999998 s = 57.673259000000002 s = 58.173529000000002 s = 58.673796000000003 s = 59.174042000000000 s = 59.674518999999997 s = 0.174796000000000 ans = '08-Nov-2017 14:00:00' mmss_dec = 4.870444536209106e-05

### Community Treasure Hunt

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

Start Hunting!