refactor: replace calls to create GMT NSTimeZone instance

Fixes #3757
pull/278/head
Francis Lachapelle 2019-12-11 11:13:36 -05:00
parent eafbdd3884
commit 2b33d45346
8 changed files with 10 additions and 10 deletions

View File

@ -199,7 +199,7 @@ static inline id GetProperty(NSDictionary *_set, NSString *_name) {
if ([val respondsToSelector:@selector(descriptionWithCalendarFormat:)]) {
static NSTimeZone *gmt = nil;
if (gmt == nil) gmt = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
if (gmt == nil) gmt = [NSTimeZone timeZoneForSecondsFromGMT: 0];
[val setTimeZone:gmt];
val = [val descriptionWithCalendarFormat:calfmt];
}

View File

@ -32,7 +32,7 @@
static NSTimeZone *gmt = nil;
static inline void _setupGMT(void) {
if (gmt == nil)
gmt = [[NSTimeZone timeZoneWithAbbreviation:@"GMT"] retain];
gmt = [[NSTimeZone timeZoneForSecondsFromGMT: 0] retain];
}
@implementation NSCalendarDate(iCalRepresentation)

View File

@ -340,7 +340,7 @@
second = 0;
}
utc = [NSTimeZone timeZoneWithAbbreviation: @"GMT"];
utc = [NSTimeZone timeZoneForSecondsFromGMT: 0];
date = [NSCalendarDate dateWithYear: year month: month
day: day hour: hour minute: minute
second: second

View File

@ -107,7 +107,7 @@
NSCalendarDate *utcStart, *utcEnd;
NSTimeZone *uTZ;
uTZ = [NSTimeZone timeZoneWithAbbreviation: @"GMT"];
uTZ = [NSTimeZone timeZoneForSecondsFromGMT: 0];
utcStart = [start copy];
utcEnd = [end copy];
[utcStart setTimeZone: uTZ];

View File

@ -45,7 +45,7 @@
if ((self = [super init]))
{
address = nil;
timeZone = [NSTimeZone timeZoneWithAbbreviation: @"GMT"];
timeZone = [NSTimeZone timeZoneForSecondsFromGMT: 0];
[timeZone retain];
startDate = nil;
endDate = nil;

View File

@ -112,7 +112,7 @@
appName = [[context request] applicationName];
date = [NSCalendarDate calendarDate];
[date setTimeZone: [NSTimeZone timeZoneWithAbbreviation: @"GMT"]];
[date setTimeZone: [NSTimeZone timeZoneForSecondsFromGMT: 0]];
if (username)
{
// Cookie expires in one month
@ -151,7 +151,7 @@
if (cookieReset)
{
date = [NSCalendarDate calendarDate];
[date setTimeZone: [NSTimeZone timeZoneWithAbbreviation: @"GMT"]];
[date setTimeZone: [NSTimeZone timeZoneForSecondsFromGMT: 0]];
[locationCookie setExpires: [date yesterday]];
}

View File

@ -98,7 +98,7 @@
cookie = nil;
date = [NSCalendarDate calendarDate];
[date setTimeZone: [NSTimeZone timeZoneWithAbbreviation: @"GMT"]];
[date setTimeZone: [NSTimeZone timeZoneForSecondsFromGMT: 0]];
// We cleanup the memecached/database session cache. We do this before
// invoking _logoutCookieWithDate: in order to obtain its value.
@ -151,7 +151,7 @@
appName = [rq applicationName];
[locationCookie setPath: [NSString stringWithFormat: @"/%@/", appName]];
date = [NSCalendarDate calendarDate];
[date setTimeZone: [NSTimeZone timeZoneWithAbbreviation: @"GMT"]];
[date setTimeZone: [NSTimeZone timeZoneForSecondsFromGMT: 0]];
[locationCookie setExpires: [date yesterday]];
return locationCookie;

View File

@ -434,7 +434,7 @@
response = [self redirectToLocation: [self _logoutRedirectURL]];
date = [NSCalendarDate calendarDate];
[date setTimeZone: [NSTimeZone timeZoneWithAbbreviation: @"GMT"]];
[date setTimeZone: [NSTimeZone timeZoneForSecondsFromGMT: 0]];
// We cleanup the memecached/database session cache. We do this before
// invoking _logoutCookieWithDate: in order to obtain its value.