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

Group
 
 

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

Submitter:  Yavor Doganov <yavor>
Submitted:  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
* Mandatory Fields

Add a New Comment Rich Markup
   

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

I applied that patch ... thanks.

Richard Frith-Macdonald <CaS>
Group 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
%H:%M:%S
04:03:30
(nil)
13:19:28
$ LC_ALL=en_US.UTF-8 ./obj/test2
%r
04:03:30 AM
(nil)
01:19:40 PM
$ ./obj/test2
%k,%M,%S
 4,03,30
 1,02,03
13,19,51
$ defaults write NSGlobalDomain GSMacOSXCompatible YES
$ LC_ALL=C ./obj/test2
%H:%M:%S
04:03:30
(nil)
13:20:20
$ LC_ALL=en_US.UTF-8 ./obj/test2
%r
04:03:30 AM
(nil)
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
%k,%M,%S
%k,03,30
(nil)
%k,20,45

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>
Group 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
%H:%M:%S
15:37:17
$ LC_ALL=en_US.UTF-8 ./obj/test
%r
03:38:37 PM
$ ./obj/test
%k,%M,%S
%k,38,48

Yavor Doganov <yavor>

 

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

Attach Files:
   
   
Comment:
   

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
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    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.13-f8d8.
    Corresponding source code