hanpa

Time steps for kitchen timer

Jun 25th, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. ///Time steps for kitchen timer....
  2.  
  3. int time_step (int seconds) {
  4.   // Returns a suitable maximum amount of step in seconds when changing a timer, based on the current value
  5.   if (seconds < 60) {
  6.     return 5; // < 1min
  7.   } else if (seconds < 5 * 60) {
  8.     return 10; // < 5min
  9.   } else if (seconds < 30 * 60) {
  10.     return 30; // <  30min
  11.   } else if (seconds < 60 * 60) {
  12.     return 60; // <1h
  13.   } else if (seconds < 2 * 60 * 60) {
  14.     return 5 * 60; // <2h
  15.   } else if (seconds < 3 * 60 * 60) {
  16.     return 15 * 60; // <3h
  17.   } else if (seconds < 12 * 60 * 60) {
  18.     return 30 * 60; // <12h
  19.   } else {
  20.     return 60 * 60;
  21.   }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment