[gnome-sound-recorder] Only show hours if necessary
- From: Meg Ford (Margaret) <megford src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sound-recorder] Only show hours if necessary
- Date: Tue, 30 Dec 2014 04:56:00 +0000 (UTC)
commit c8072d97423e0adaff913bf7dddeaf90a567f764
Author: Meg Ford <megford gnome org>
Date: Sun Dec 28 12:25:41 2014 -0600
Only show hours if necessary
Don't show e.g. 00:00:02 in timestrings as it looks clumsy.
src/mainWindow.js | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index db23271..1ebc416 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -204,19 +204,18 @@ const MainView = new Lang.Class({
_formatTime: function(unformattedTime) {
this.unformattedTime = unformattedTime;
let seconds = Math.floor(this.unformattedTime);
- let hours = parseInt( seconds / Math.pow(_TIME_DIVISOR, 2));
- let hoursString = "00"
+ let hours = parseInt(seconds / Math.pow(_TIME_DIVISOR, 2));
+ let hoursString = ""
if (hours > 10)
- hoursString = hours
+ hoursString = hours + ":"
else if (hours < 10 && hours > 0)
- hoursString = "0" + hours
+ hoursString = "0" + hours + ":"
- let minuteString = parseInt( seconds / _TIME_DIVISOR ) % _TIME_DIVISOR;
- let secondString = seconds % _TIME_DIVISOR;
+ let minuteString = parseInt(seconds / _TIME_DIVISOR) % _TIME_DIVISOR;
+ let secondString = parseInt(seconds % _TIME_DIVISOR);
let timeString =
hoursString +
- ":" +
(minuteString < 10 ? "0" + minuteString : minuteString)+
":" +
(secondString < 10 ? "0" + secondString : secondString);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]