diff options
Diffstat (limited to 'apps/plugins/battery_test.c')
-rw-r--r-- | apps/plugins/battery_test.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/apps/plugins/battery_test.c b/apps/plugins/battery_test.c index 01a075f72b..843c03ea7b 100644 --- a/apps/plugins/battery_test.c +++ b/apps/plugins/battery_test.c | |||
@@ -69,12 +69,25 @@ void loop(void) | |||
69 | rb->splash(HZ, true, "Failed creating /battery.log"); | 69 | rb->splash(HZ, true, "Failed creating /battery.log"); |
70 | break; | 70 | break; |
71 | } | 71 | } |
72 | #ifdef HAVE_RTC | ||
72 | t = rb->get_time(); | 73 | t = rb->get_time(); |
74 | #else | ||
75 | { | ||
76 | static struct tm temp; | ||
77 | long t2 = *rb->current_tick/HZ; | ||
78 | temp.tm_hour=t2/3600; | ||
79 | temp.tm_min=(t2/60)%60; | ||
80 | temp.tm_sec=t2%60; | ||
81 | t=&temp; | ||
82 | } | ||
83 | #endif | ||
73 | rb->snprintf(buf, sizeof buf, "%02d:%02d:%02d Battery %d%%\n", | 84 | rb->snprintf(buf, sizeof buf, "%02d:%02d:%02d Battery %d%%\n", |
74 | t->tm_hour, t->tm_min, t->tm_sec, batt); | 85 | t->tm_hour, t->tm_min, t->tm_sec, batt); |
75 | rb->write(f, buf, rb->strlen(buf)); | 86 | rb->write(f, buf, rb->strlen(buf)); |
76 | rb->close(f); | 87 | rb->close(f); |
77 | 88 | ||
89 | rb->snprintf(buf, sizeof buf, "%02d:%02d:%02d Battery %d%%%%", | ||
90 | t->tm_hour, t->tm_min, t->tm_sec, batt); | ||
78 | rb->splash(0, true, buf); | 91 | rb->splash(0, true, buf); |
79 | 92 | ||
80 | /* simulate 128kbit/s (16kbyte/s) playback duration */ | 93 | /* simulate 128kbit/s (16kbyte/s) playback duration */ |