summaryrefslogtreecommitdiff
path: root/apps/misc.c
diff options
context:
space:
mode:
authorMagnus Holmgren <magnushol@gmail.com>2007-02-17 13:36:44 +0000
committerMagnus Holmgren <magnushol@gmail.com>2007-02-17 13:36:44 +0000
commit14ba91eaa9a94411457cc396a4c7c5e39e63a00a (patch)
treea550e288bda8052a05feb5355df0a16f39897466 /apps/misc.c
parent471d881979e0027737a435fd03efea493ea696f3 (diff)
downloadrockbox-14ba91eaa9a94411457cc396a4c7c5e39e63a00a.zip
rockbox-14ba91eaa9a94411457cc396a4c7c5e39e63a00a.tar.gz
rockbox-14ba91eaa9a94411457cc396a4c7c5e39e63a00a.tar.bz2
rockbox-14ba91eaa9a94411457cc396a4c7c5e39e63a00a.tar.xz
A few more bookmark code tweaks. Also improves how the bookmark selection screen is displayed on Archos players.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12350 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/misc.c')
-rw-r--r--apps/misc.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/apps/misc.c b/apps/misc.c
index 8487da0..d072d4f 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -186,6 +186,27 @@ char *create_numbered_filename(char *buffer, const char *path,
return buffer;
}
+/* Format time into buf.
+ *
+ * buf - buffer to format to.
+ * buf_size - size of buffer.
+ * t - time to format, in milliseconds.
+ */
+void format_time(char* buf, int buf_size, long t)
+{
+ if ( t < 3600000 )
+ {
+ snprintf(buf, buf_size, "%d:%02d",
+ (int) (t / 60000), (int) (t % 60000 / 1000));
+ }
+ else
+ {
+ snprintf(buf, buf_size, "%d:%02d:%02d",
+ (int) (t / 3600000), (int) (t % 3600000 / 60000),
+ (int) (t % 60000 / 1000));
+ }
+}
+
#ifdef CONFIG_RTC
/* Create a filename with a date+time part.
It is allowed that buffer and path point to the same memory location,