summaryrefslogtreecommitdiff
path: root/apps/misc.c
diff options
context:
space:
mode:
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 8487da0d98..d072d4f881 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -186,6 +186,27 @@ char *create_numbered_filename(char *buffer, const char *path,
186 return buffer; 186 return buffer;
187} 187}
188 188
189/* Format time into buf.
190 *
191 * buf - buffer to format to.
192 * buf_size - size of buffer.
193 * t - time to format, in milliseconds.
194 */
195void format_time(char* buf, int buf_size, long t)
196{
197 if ( t < 3600000 )
198 {
199 snprintf(buf, buf_size, "%d:%02d",
200 (int) (t / 60000), (int) (t % 60000 / 1000));
201 }
202 else
203 {
204 snprintf(buf, buf_size, "%d:%02d:%02d",
205 (int) (t / 3600000), (int) (t % 3600000 / 60000),
206 (int) (t % 60000 / 1000));
207 }
208}
209
189#ifdef CONFIG_RTC 210#ifdef CONFIG_RTC
190/* Create a filename with a date+time part. 211/* Create a filename with a date+time part.
191 It is allowed that buffer and path point to the same memory location, 212 It is allowed that buffer and path point to the same memory location,