Package: x11-apps Version: 7.7~1 Followup-For: Bug #640011 Dear Maintainer,
This bug arises from a conflict between the -strftime and -twentyfour options. When -strftime is specified by the user, it makes sense to ignore -twentyfour (perhaps even warn about it) because the user is specifying exactly what they want. It would be unreasonable for -twentyfour to attempt to do anything. What's happening here is xclock is automatically setting the -strftime option to "%c" when the locale is set, so it appears that the user is always using the -strftime option. This causes -twentyfour to be ignored here, ./xclock -digital -twentyfour because of an implicit "-strftime %c" argument. My proposed patch keeps track of whether or not strftime was automatically set in response to locale (strftime_autoset) or set by the user, allowing for the intended, but never reached, fallback to the 24-hour asctime(). In the meantime, there are several workarounds: * Choose a locale with a 24-hour clock so that strftime's "%c" uses a 24-hour clock. (i.e. LC_TIME=C rather than en_US.UTF-8) * Use the strftime option to specific precisely what you want. * Similarly, set the env variable CFTIME to your strftime string. -- System Information: Debian Release: wheezy/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: i386 (i686) Kernel: Linux 3.2.0-2-686-pae (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages x11-apps depends on: ii cpp 4:4.7.0-6 ii libc6 2.13-32 ii libpng12-0 1.2.49-1 ii libsm6 2:1.2.1-2 ii libx11-6 2:1.4.99.901-2 ii libxaw7 2:1.0.10-2 ii libxcursor1 1:1.1.13-1 ii libxext6 2:1.3.1-2 ii libxft2 2.2.0-3 ii libxkbfile1 1:1.0.8-1 ii libxmu6 2:1.1.1-1 ii libxmuu1 2:1.1.1-1 ii libxrender1 1:0.9.7-1 ii libxt6 1:1.1.3-1 Versions of packages x11-apps recommends: ii xbitmaps 1.1.1-1 Versions of packages x11-apps suggests: ii mesa-utils 8.0.1-2+b3 -- no debconf information
--- a/xclock/Clock.c +++ b/xclock/Clock.c @@ -541,7 +541,10 @@ tsec = time(NULL); sprintf (utime, "%10lu seconds since Epoch", (unsigned long)tsec); return utime; - } else if (*w->clock.strftime) { + } + else if (w->clock.twentyfour && w->clock.strftime_autoset) + return asctime (tm); + else if (*w->clock.strftime) { /*Note: this code is probably excessively paranoid about buffer overflow. The extra size 10 padding is also meant as a further guard against programmer @@ -555,8 +558,6 @@ return asctime (tm); } } - else if (w->clock.twentyfour) - return asctime (tm); else { static char long12[28]; @@ -607,6 +608,7 @@ w->clock.strftime = getenv("CFTIME"); if (w->clock.strftime == NULL) { w->clock.strftime = "%c"; + w->clock.strftime_autoset = True; } } } --- a/xclock/ClockP.h +++ b/xclock/ClockP.h @@ -95,6 +95,7 @@ Boolean twentyfour; Boolean utime; String strftime; + Boolean strftime_autoset; Boolean show_second_hand; Dimension second_hand_length; Dimension minute_hand_length;