summaryrefslogtreecommitdiffstats
path: root/apps/recorder/icons.c
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-08-30 00:39:31 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-08-30 00:39:31 +0000
commitb847a7b296328a08eef4c74492dbd0056dff1318 (patch)
tree9ca1c5e311ace2dc9ae42229367065c6d0176040 /apps/recorder/icons.c
parent924b5313ac2fe15d13b662ff762094ffb6f4ab5d (diff)
downloadrockbox-b847a7b296328a08eef4c74492dbd0056dff1318.tar.gz
rockbox-b847a7b296328a08eef4c74492dbd0056dff1318.zip
Added status_draw() to set_playmode().
Moved rtc reading from icons.c code to status.c Added boundary checks for time display values. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2066 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder/icons.c')
-rw-r--r--apps/recorder/icons.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c
index d1ee11dbed..3f6518903f 100644
--- a/apps/recorder/icons.c
+++ b/apps/recorder/icons.c
@@ -290,23 +290,33 @@ void statusbar_icon_lock(void)
/*
* Print time to status bar
*/
-void statusbar_time(void)
+void statusbar_time(int minutes)
{
- int hour,minute;
unsigned char buffer[6];
unsigned int width, height;
#if defined(LOADABLE_FONTS)
unsigned char *font;
#endif
- hour = rtc_read(0x03);
- minute = rtc_read(0x02);
+ int hour = minutes / 60;
+ int minute = minutes % 60;
+
+ if ( hour >= 0 &&
+ hour <= 23 &&
+ minute >= 0 &&
+ minute <= 59 )
+ {
+ snprintf(buffer, sizeof(buffer), "%d%d:%d%d",
+ (hour & 0x30) >> 4,
+ hour & 0x0f,
+ (minute & 0xf0) >> 4,
+ minute & 0x0f);
+ }
+ else
+ {
+ strncpy(buffer, "--:--", sizeof buffer);
+ }
- snprintf(buffer, sizeof(buffer), "%d%d:%d%d",
- (hour & 0x30) >> 4,
- hour & 0x0f,
- (minute & 0xf0) >> 4,
- minute & 0x0f);
#if defined(LCD_PROPFONTS)
lcd_getstringsize(buffer, 0, &width, &height);
#elif defined(LOADABLE_FONTS)