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

 
 

You are not allowed to post comments on this tracker with your current authentication level.

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/FoundationSeverity: 3 - Normal
Item Group: Change RequestStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

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
%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>
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
%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>

 

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
  • -unavailable- added by CaS (Posted a comment)
  • -unavailable- added by yavor (Submitted the item)
  • -unavailable- added by yavor
  •  

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

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 17 Mar 2010 05:46:44 AM UTCCaSStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Sat 13 Mar 2010 11:23:27 AM UTCyavorAttached File-=>Added k.patch, #19929
      Attached File-=>Added test2.m, #19930
    Fri 12 Mar 2010 01:41:18 PM UTCyavorAttached File-=>Added test.m, #19920
      Carbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1