[gnome-shell] clock: update every second
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] clock: update every second
- Date: Mon, 14 Mar 2011 18:39:03 +0000 (UTC)
commit 4b2d6f8a992e55027dcffba8f6c7aac2318522a8
Author: David Zeuthen <davidz redhat com>
Date: Mon Mar 14 10:32:15 2011 -0400
clock: update every second
If we don't update every second, we may show the wrong time for up to
a minute on 1. resume; or 2. when changing the time; or 3. when
changing the timezone. This is both annoying and and leads to people
thinking that the tool for changing the time / timezone is broken.
https://bugzilla.gnome.org/show_bug.cgi?id=635840
Signed-off-by: David Zeuthen <davidz redhat com>
js/ui/dateMenu.js | 17 +----------------
1 files changed, 1 insertions(+), 16 deletions(-)
---
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index ad2c112..8d35bbc 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -185,21 +185,6 @@ DateMenuButton.prototype = {
}
let displayDate = new Date();
- let msecRemaining;
- if (showSeconds) {
- msecRemaining = 1000 - displayDate.getMilliseconds();
- if (msecRemaining < 50) {
- displayDate.setSeconds(displayDate.getSeconds() + 1);
- msecRemaining += 1000;
- }
- } else {
- msecRemaining = 60000 - (1000 * displayDate.getSeconds() +
- displayDate.getMilliseconds());
- if (msecRemaining < 500) {
- displayDate.setMinutes(displayDate.getMinutes() + 1);
- msecRemaining += 60000;
- }
- }
this._clock.set_text(displayDate.toLocaleFormat(clockFormat));
@@ -209,7 +194,7 @@ DateMenuButton.prototype = {
dateFormat = _("%A %B %e, %Y");
this._date.set_text(displayDate.toLocaleFormat(dateFormat));
- Mainloop.timeout_add(msecRemaining, Lang.bind(this, this._updateClockAndDate));
+ Mainloop.timeout_add_seconds(1, Lang.bind(this, this._updateClockAndDate));
return false;
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]