View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0005157 | ardour | bugs | public | 2012-11-01 19:52 | 2015-09-18 15:27 |
| Reporter | colinf | Assigned To | paul | ||
| Priority | normal | Severity | trivial | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Summary | 0005157: Ardour's wall clock time display lags | ||||
| Description | The wall-clock time displayed in the status bar only appears to be updated once per minute, so it can lag the computer's actual wall-clock by up to that amount. Would updating it once per second be overkill? | ||||
| Tags | No tags attached. | ||||
|
|
i think its overkill, but i see your point. i think we have a timeout set for every second already ... |
|
2012-11-30 17:12
|
wall-clock-seconds-update.patch (1,013 bytes)
Index: gtk2_ardour/ardour_ui.cc
===================================================================
--- gtk2_ardour/ardour_ui.cc (revision 13572)
+++ gtk2_ardour/ardour_ui.cc (working copy)
@@ -426,7 +426,7 @@
#ifndef GTKOSX
/* OS X provides a nearly-always visible wallclock, so don't be stupid */
update_wall_clock ();
- Glib::signal_timeout().connect (sigc::mem_fun(*this, &ARDOUR_UI::update_wall_clock), 60000);
+ Glib::signal_timeout().connect_seconds (sigc::mem_fun(*this, &ARDOUR_UI::update_wall_clock), 1);
#endif
update_disk_space ();
@@ -1097,14 +1097,17 @@
{
time_t now;
struct tm *tm_now;
- char buf[16];
+ static int last_min = -1;
time (&now);
tm_now = localtime (&now);
+ if (last_min != tm_now->tm_min) {
+ char buf[16];
+ sprintf (buf, "%02d:%02d", tm_now->tm_hour, tm_now->tm_min);
+ wall_clock_label.set_text (buf);
+ last_min = tm_now->tm_min;
+ }
- sprintf (buf, "%02d:%02d", tm_now->tm_hour, tm_now->tm_min);
- wall_clock_label.set_text (buf);
-
return TRUE;
}
|
|
|
Using Glib::signal_timeout().connect_seconds() gets a timer with accuracy to the nearest second, which will share a wakeup with any other timer that fires at a close-enough time, so I think that's the right thing to do here. Also, as a tiny optimisation, we don't need to update wall_clock_label unless it's actually changed: I've done this with an old-skool static variable. If anyone has an idea of how to do that better, or thinks it's unnecessary, I'm not at all attached to the idea, but otherwise I'll commit the patch above. |
|
|
Glib::signal_timeout() is in milli-seconds. surely 1 sec accuracy is sufficient for a minute clock. Calling it every ms is not a good idea. otherwise +1 for applying this patch. |
|
|
applied, with a 1 second timeout |
|
|
Closing old issues reported by me: these have long since been fixed. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2012-11-01 19:52 | colinf | New Issue | |
| 2012-11-06 18:06 | paul | Note Added: 0014180 | |
| 2012-11-30 17:12 | colinf | File Added: wall-clock-seconds-update.patch | |
| 2012-11-30 17:26 | colinf | Note Added: 0014307 | |
| 2012-12-26 16:17 | x42 | Note Added: 0014392 | |
| 2012-12-26 16:44 | paul | cost | => 0.00 |
| 2012-12-26 16:44 | paul | Note Added: 0014393 | |
| 2012-12-26 16:44 | paul | Status | new => resolved |
| 2012-12-26 16:44 | paul | Resolution | open => fixed |
| 2012-12-26 16:44 | paul | Assigned To | => paul |
| 2015-09-18 15:27 | colinf | Note Added: 0017306 | |
| 2015-09-18 15:27 | colinf | Status | resolved => closed |