Browse Source

Handle hours >= 100

Scott Lahteine 8 years ago
parent
commit
c6859a1e54
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      Marlin/duration_t.h

+ 4
- 2
Marlin/duration_t.h View File

@@ -146,12 +146,14 @@ struct duration_t {
146 146
    *  11d 12:33
147 147
    */
148 148
   void toDigital(char *buffer, bool with_days=false) const {
149
-    uint16_t h = uint16_t(this->hour() % 24UL),
149
+    uint16_t h = uint16_t(this->hour()),
150 150
              m = uint16_t(this->minute() % 60UL);
151 151
     if (with_days)
152 152
       sprintf_P(buffer, PSTR("%ud %02u:%02u"), this->day(), h, m);
153
+    else if (h < 100)
154
+      sprintf_P(buffer, PSTR("%02u:%02u"), h % 24, m);
153 155
     else
154
-      sprintf_P(buffer, PSTR("%02u:%02u"), h, m);
156
+      sprintf_P(buffer, PSTR("%u:%02u"), h, m);
155 157
   }
156 158
 };
157 159
 

Loading…
Cancel
Save