[924] in athena10
seconds in gdmgreeter (was: [ATN-4] More greeter ...)
daemon@ATHENA.MIT.EDU (John Hawkinson)
Thu Jan 22 20:36:42 2009
Date: Thu, 22 Jan 2009 20:35:42 -0500
From: John Hawkinson <jhawk@MIT.EDU>
To: Jonathan Reed <jdreed@MIT.EDU>
Cc: Athena 10 <athena10@MIT.EDU>
Message-ID: <20090123013542.GZ29687@multics.mit.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <AB1D7FFD-EF4B-4482-ABDC-F4C4FAA83A19@MIT.EDU>
Jonathan Reed <jdreed@MIT.EDU> wrote on Thu, 22 Jan 2009
at 10:57:51 -0500 in <AB1D7FFD-EF4B-4482-ABDC-F4C4FAA83A19@MIT.EDU>:
> The clock is created by putting the text "%c" in one of the widgets.
> Although this looks tantalizingly like a strftime(3) format string,
> it's not. It's the current locale's default representation of the
...
> I have not yet UTSL'd to confirm this, and if anyone comes up with a way
> (that does not involve reubilding gdm or hacking the en_US locale) to get a
> different date/time representation, I'll consider it.
FWIW, I did take a look and you're right. The problems are twofold:
(1) Making gdm display the second at all (2) Making it update the clock
more than 1x/minute.
Attached is a hack patch that I don't expect you or anyone else to
take that makes it work ("proof of the wrong concept"); I attach it
for your amusement value. It has gdm use seconds, and also removes the
code to compute the number of second until the next minute and queue a
display update, and instead just updates the display 1x/second.
I do suspect there is a gdm bug here, because of talk of how gdm ought
to update clock items 1/sec in various documentation, but actually it
calls update_clock() 1/min.
Becuase the time format goes through ve_strftime(), which does locale-specific
magic, it might be feasible to fix locales to cause %M to return second,
or somesuch, but that's probably not the way to go.
Somewhat tangentially, we display the time in AM/PM format instead of 24-hour
format, and I don't think that's a good change to make. That is controlled
by:
| gdm_common_select_time_format (void)
| {
| gchar *val = gdm_config_get_string (GDM_KEY_USE_24_CLOCK);
|
| if (val != NULL &&
| (val[0] == 'T' ||
...
| return TRUE;
| } else if (val != NULL &&
| (val[0] == 'F' ||
...
| return FALSE;
| } else {
| /* Value is "auto" (default), thus select according to
| "locale" settings. */
./daemon/gdm-daemon-config-keys.h:#define GDM_KEY_USE_24_CLOCK "greeter/Use24Clock=auto"
So presumably we should set the greeter/Use24Clock=true.
I'll look into filing a bug with Ubuntu.
Separately, geofft suggested the mechanism used to include xscreensaver
hacks in the background could be used to provide an updating block.
I'll look into that, but I'm not too optimistic.
--jhawk
diff -ur gdm-2.20.7/gui/gdmcommon.c ../gdm-2.20.7/gui/gdmcommon.c
--- gdm-2.20.7/gui/gdmcommon.c 2008-06-30 13:53:05.000000000 -0400
+++ ../gdm-2.20.7/gui/gdmcommon.c 2009-01-22 19:47:10.000000000 -0500
@@ -844,13 +892,13 @@
*the_tm = localtime (&the_time);
if (gdm_common_select_time_format ()) {
- str = ve_strftime (*the_tm, _("%a %b %d, %H:%M"));
+ str = ve_strftime (*the_tm, _("%a %b %d, %T"));
} else {
/* Translators: You should translate time part as
%H:%M if your language does not have AM and PM
equivalent. Note: %l is a strftime option for
12-hour clock format */
- str = ve_strftime (*the_tm, _("%a %b %d, %l:%M %p"));
+ str = ve_strftime (*the_tm, _("%a %b %d, %T"));
}
return str;
diff -ur gdm-2.20.7/gui/greeter/greeter_item_clock.c ../gdm-2.20.7/gui/greeter/greeter_item_clock.c
--- gdm-2.20.7/gui/greeter/greeter_item_clock.c 2008-06-30 13:53:05.000000000 -0400
+++ ../gdm-2.20.7/gui/greeter/greeter_item_clock.c 2009-01-22 19:45:28.000000000 -0500
@@ -36,10 +36,11 @@
time (&the_time);
the_tm = localtime (&the_time);
/* account for leap seconds */
- time_til_next_min = 60 - the_tm->tm_sec;
- time_til_next_min = (time_til_next_min>=0?time_til_next_min:0);
+ //time_til_next_min = 60 - the_tm->tm_sec;
+ //time_til_next_min = (time_til_next_min>=0?time_til_next_min:0);
- g_timeout_add (time_til_next_min*1000, update_clock, info);
+ // g_timeout_add (time_til_next_min*1000, update_clock, info);
+ g_timeout_add (1000, update_clock, info);
return FALSE;
}