Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix: Use the current locale for CTCP-Time replies. #136

Closed
wants to merge 1 commit into from

2 participants

@Xeago

CTCP Time is supposed to return the local time of the client,
not the GMT time which [[NSDate date] description] returns.

https://en.wikipedia.org/wiki/Client-to-client_protocol#Common_CTCP_Commands

Before:

2013-01-10 19:02:50 +0000

After:

Thursday, January 10, 2013 7:02:50 PM Central European Time
@Xeago Xeago Fix: Use the current locale for CTCP-Time replies.
CTCP Time is supposed to return the local time of the client,
not the GMT time which [[NSDate date] description] returns.

https://en.wikipedia.org/wiki/Client-to-client_protocol#Common_CTCP_Commands

Before:

    2013-01-10 19:02:50 +0000

After:

    Thursday, January 10, 2013 7:02:50 PM Central European Time
1143987
@psychs psychs closed this
@psychs
Owner

Thanks. But with this patch, users in ja_JP locale will return "2013年7月2日 火曜日 8時34分56秒 日本標準時". I think it's not good for most people. I pushed a patch to fix the issue so that CTCP time replies contain time zones.

@Xeago

Thanks, I don't have much experience with Cocoa. This was the first method I found that gave information including the time-zone. I hope my code served with good intent.

Thanks for improving my code and providing a better solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 10, 2013
  1. @Xeago

    Fix: Use the current locale for CTCP-Time replies.

    Xeago authored
    CTCP Time is supposed to return the local time of the client,
    not the GMT time which [[NSDate date] description] returns.
    
    https://en.wikipedia.org/wiki/Client-to-client_protocol#Common_CTCP_Commands
    
    Before:
    
        2013-01-10 19:02:50 +0000
    
    After:
    
        Thursday, January 10, 2013 7:02:50 PM Central European Time
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  Classes/IRC/IRCClient.m
View
2  Classes/IRC/IRCClient.m
@@ -2554,7 +2554,7 @@ - (void)receiveCTCPQuery:(IRCMessage*)m text:(NSString*)text
[self sendCTCPReply:nick command:command text:s];
}
else if ([command isEqualToString:TIME]) {
- NSString* text = [[NSDate date] description];
+ NSString* text = [[NSDate date] descriptionWithLocale:[NSLocale currentLocale]];
[self sendCTCPReply:nick command:command text:text];
}
else if ([command isEqualToString:VERSION]) {
Something went wrong with that request. Please try again.