| 814 /* apply the microseconds */ |
815 /* apply the microseconds */ |
| 815 used_time += micros / 1000000; |
816 used_time += micros / 1000000; |
| 816 |
817 |
| 817 return used_time >= total_time ? 0 : total_time - used_time; |
818 return used_time >= total_time ? 0 : total_time - used_time; |
| 818 } |
819 } |
| |
820 |
| |
821 void print_clk(uint16_t time, char *str, bool always_hours) { |
| |
822 unsigned hours = time / 3600; |
| |
823 unsigned minutes = (time % 3600) / 60; |
| |
824 unsigned seconds = time % 60; |
| |
825 if (hours > 0 || always_hours) { |
| |
826 snprintf(str, 9, "%02u:%02u:%02u", hours, minutes, seconds); |
| |
827 } else { |
| |
828 snprintf(str, 6, "%02u:%02u", minutes, seconds); |
| |
829 } |
| |
830 } |