Bug#762266: "(null)" gets displayed instead of date on screen unlocking dialog

Nachanon Vetjasit nachanon.vetjasit at gmail.com
Mon Oct 27 12:10:19 UTC 2014


Hello Mike,

> 1.
> What does (run from the cmdline) give:
>
>    $ date +%x
>
>    $ date +%X

It seems that %x and %X are printed properly using `date` command in my
locale settings. (th_TH manner):

$ date +%x
27/10/2557
$ date +%X
15:36:56
$ locale
LANG=th_TH
LANGUAGE=
LC_CTYPE=th_TH
LC_NUMERIC=th_TH
LC_TIME=th_TH
LC_COLLATE=th_TH
LC_MONETARY=th_TH
LC_MESSAGES=en_US
LC_PAPER=th_TH
LC_NAME=th_TH
LC_ADDRESS=th_TH
LC_TELEPHONE=th_TH
LC_MEASUREMENT=th_TH
LC_IDENTIFICATION=th_TH
LC_ALL=
$

However, this might be more complicated that %x and %X in
g_date_time_format() seems to works when run in isolated case.
Nevertheless, %x works in not-so-correct fashion, as it printed
mm/dd/yy (en_US) rather than dd/mm/yy (th_TH).

I tested with this snippet, which adapted from mate-sceensaver_1.8.0-5~bpo70+1
source package's `src/gs-lock-plug.c` function `date_time_update`:

#include <glib/gstdio.h>
#include <glib/gprintf.h>

int main() {
	GDateTime *datetime;
	gchar *time;
	gchar *date;
	gchar *str;
	
	datetime=g_date_time_new_now_local();
	time=g_date_time_format(datetime, "%X");
	date=g_date_time_format(datetime, "%x");
	
	str = g_strdup_printf("<span size=\"xx-large\"
weight=\"ultrabold\">%s</span>", time);
	g_printf("%s\n",str);
	g_free(str);
	
	str=g_strdup_printf("<span size=\"large\">%s</span>", date);
	g_printf("%s\n",str);
	g_free(str);
	
	g_free(time);
	g_free(date);
	g_date_time_unref(datetime);
	
	return 0;
}

Which outputs:

$ ./glibtest
<span size="xx-large" weight="ultrabold">18:30:11</span>
<span size="large">10/27/14</span>
$

Notice that the date is printed in mm/dd/yy (en_US) fashion, even when I run
it using "LC_ALL=th_TH ./glibtest".
But the time is in the correct HH:mm:ss 24-hours (th_TH) fashion.

Regards,
Nachanon



More information about the pkg-mate-team mailing list