Bug 5251

Summary: xclock -digital only shows "20"
Product: xorg Reporter: Egmont Koblinger <egmont>
Component: App/otherAssignee: Alan Coopersmith <alan.coopersmith>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high    
Version: 6.99.99.903 (7.0 RC3)   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 1690    

Description Egmont Koblinger 2005-12-06 08:09:10 UTC
"xclock -digital" pops up a window showing "20". It's the first two digits of
the year, that is, 19 if I set back the clock to 1999. Not really usable as a
clock :-)

In Clock.c the format string passed to strftime is initialized to "%C" with
upper-case C. According to my strftime manpage:

       %c     The preferred date and time representation for the current
              locale.

       %C     The century number (year/100) as a 2-digit integer. (SU)

So to fix the problem all you need to do is replace "%C" with "%c" (lower-case
c) in Clock.c. There are two instances of this string in Clock.c, the first
is inside a comment, and the next one is in the real source.

(Sorry, it's too late in the evening and I'm too lazy now to send such a
trivial patch.)
Comment 1 Alan Coopersmith 2005-12-07 03:09:42 UTC
Oops - the i18n work here was done on Solaris, in which %C depends on whether
you are in standards-conformance mode or not:

  Default
     %C    Locale's date and time representation as  produced  by
           date(1).

  Standard conforming
     %C    Century number (the year divided by 100 and  truncated
           to  an  integer  as  a  decimal number [1,99]); single
           digits are preceded by 0; see standards(5).

and when I contributed the work done by our i18n group back to Xorg I didn't
notice that we'd used the Solaris-only meaning.   I'll fix this.
Comment 2 Alan Coopersmith 2005-12-07 03:32:47 UTC
Fixed in CVS:

CVSROOT:	/cvs/xorg
Module name:	xc
Changes by:	alanc@gabe.freedesktop.org	05/12/06 08:26:52

Log message:
  2005-12-06  Alan Coopersmith  <alan.coopersmith@sun.com>
  
  	* programs/xclock/Clock.c:
  	Bugzilla #5251 <https://bugs.freedesktop.org/show_bug.cgi?id=5251>
  	xclock -digital only shows "20" (Egmont Koblinger)

Modified files:
      xc/programs/xclock/:
        Clock.c 
      ./:
        ChangeLog 
  
  Revision      Changes    Path
  1.5           +3 -3      xc/programs/xclock/Clock.c
  http://cvs.freedesktop.org/xorg/xc/programs/xclock/Clock.c
  1.1546        +6 -0      xc/ChangeLog
  http://cvs.freedesktop.org/xorg/xc/ChangeLog

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.