bugGNUstep - Bugs: bug #29208, NSCalendarDate's format does not...


bug #29208: NSCalendarDate's format does not support the %k conversion specifier

Submitted by:  Yavor Doganov <yavor>
Submitted on:  Fri 12 Mar 2010 01:41:18 PM UTC  
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  Change Request Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Wed 17 Mar 2010 05:46:44 AM UTC, comment #3: 

I applied that patch ... thanks.

Richard Frith-Macdonald <CaS>
Project Member
Sat 13 Mar 2010 11:23:27 AM UTC, comment #2: 

Thanks.  Here is my attemt; I'd appreciate a thorough review.  The leading space is important for sorting/alignment -- I see that %e omits it (contrary to what the documentation says); probably to match Cocoa behavior?

Tested with the attached program (test2.m) as follows:

$ LC_ALL=C ./obj/test2
$ LC_ALL=en_US.UTF-8 ./obj/test2
04:03:30 AM
01:19:40 PM
$ ./obj/test2
$ defaults write NSGlobalDomain GSMacOSXCompatible YES
$ LC_ALL=C ./obj/test2
$ LC_ALL=en_US.UTF-8 ./obj/test2
04:03:30 AM
01:20:31 PM
$ ./obj/test2
2010-03-13 13:20:45.223 test2[6349] Invalid NSCalendar date, specifier k not recognized in format %k,%M,%S

P.S.  I'm not sure if my changes until now are already legally significant, but either way (whether the patch is rejected or not), I'd be happy to assign past and future changes to the FSF at any time.

(file #19929, file #19930)

Yavor Doganov <yavor>
Fri 12 Mar 2010 02:33:36 PM UTC, comment #1: 

I'd be very happy to have a patch to support this.
Yes please.

It would be ideal if you could bracket the behavior with:

if (NO == GSPrivateDefaultsFlag(GSMacOSXCompatible))

That way, if someone sets the GSMacOSXCompatible user default to YES, they would get OSX compatible behavior.

Richard Frith-Macdonald <CaS>
Project Member
Fri 12 Mar 2010 01:41:18 PM UTC, original submission:  

While preparing the upload of SimpleAgenda/0.40 for Debian I discovered something unpleasant -- the time in the app icon is displayed as '%k,<minutes>,<seconds>' when run under Bulgarian locale.  This is because our locale definition is '%k,%M,%S'.  (The %k specifier is a GNU extension according to the glibc manual, which makes its use perfectly valid in a glibc locale.)

Unfortunately NSCalendarDate (as documented) does not understand it.  I checked the Cocoa documentation, and there's no %k there too (not surprising).

Would you accept a patch implementing support for the %k specifier?  I hope that Apple not implementing it won't be an obstacle...

AFAICS from the online documentation, `strftime' in FreeBSD, OpenSolaris and even Mac OS X support it, so it's not something strictly GNU-specific.

The attached test program demonstrates the current ugliness:

$ LC_ALL=C ./obj/test
$ LC_ALL=en_US.UTF-8 ./obj/test
03:38:37 PM
$ ./obj/test

Yavor Doganov <yavor>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #19929:  k.patch added by yavor (3KiB - text/x-diff - Proposed implementation + test program)
file #19930:  test2.m added by yavor (825B - application/octet-stream - Proposed implementation + test program)
file #19920:  test.m added by yavor (401B - text/x-objcsrc)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by CaS (Posted a comment)
  • -email is unavailable- added by yavor (Submitted the item)
  • -email is unavailable- added by yavor

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-03-17 CaS StatusNone => Fixed
        Open/ClosedOpen => Closed
    2010-03-13 yavor Attached File- => Added k.patch, #19929
        Attached File- => Added test2.m, #19930
    2010-03-12 yavor Attached File- => Added test.m, #19920
        Carbon-Copy- => Added -email is unavailable-

    Back to the top

    Powered by Savane 3.7