[sushi] utils: add a common method to format a time string
- From: Cosimo Cecchi <cosimoc src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [sushi] utils: add a common method to format a time string
 
- Date: Thu, 12 May 2011 23:40:28 +0000 (UTC)
 
commit d3e107e9a776faa38b42828fcf603212f1a84676
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu May 12 18:51:00 2011 -0400
    utils: add a common method to format a time string
 src/js/ui/utils.js |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/js/ui/utils.js b/src/js/ui/utils.js
index f1f6640..ad070f0 100644
--- a/src/js/ui/utils.js
+++ b/src/js/ui/utils.js
@@ -94,3 +94,20 @@ function createRunButton(file) {
 
     return toolbarRun;
 }
+
+function formatTimeString(timeVal) {
+    let hours = Math.floor(timeVal / 3600);
+    timeVal -= hours * 3600;
+
+    let minutes = Math.floor(timeVal / 60);
+    timeVal -= minutes * 60;
+
+    let seconds = Math.floor(timeVal);
+
+    let str = ("%02d:%02d").format(minutes, seconds);
+    if (hours > 0) {
+        current = ("%d").format(hours) + ":" + current;
+    }
+
+    return str;
+}
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]