Skip to content

Commit

Permalink
refactor: replace calls to create GMT NSTimeZone instance
Browse files Browse the repository at this point in the history
Fixes #3757
  • Loading branch information
cgx committed Dec 11, 2019
1 parent eafbdd3 commit 2b33d45
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion SOPE/NGCards/IcalElements.m
Expand Up @@ -199,7 +199,7 @@ - (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx {

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];
}
Expand Down
2 changes: 1 addition & 1 deletion SOPE/NGCards/NSCalendarDate+ICal.m
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion SOPE/NGCards/NSString+NGCards.m
Expand Up @@ -340,7 +340,7 @@ - (NSCalendarDate *) asCalendarDate
second = 0;
}

utc = [NSTimeZone timeZoneWithAbbreviation: @"GMT"];
utc = [NSTimeZone timeZoneForSecondsFromGMT: 0];
date = [NSCalendarDate dateWithYear: year month: month
day: day hour: hour minute: minute
second: second
Expand Down
2 changes: 1 addition & 1 deletion SOPE/NGCards/iCalFreeBusy.m
Expand Up @@ -107,7 +107,7 @@ - (void) addFreeBusyFrom: (NSCalendarDate *) start
NSCalendarDate *utcStart, *utcEnd;
NSTimeZone *uTZ;

uTZ = [NSTimeZone timeZoneWithAbbreviation: @"GMT"];
uTZ = [NSTimeZone timeZoneForSecondsFromGMT: 0];
utcStart = [start copy];
utcEnd = [end copy];
[utcStart setTimeZone: uTZ];
Expand Down
2 changes: 1 addition & 1 deletion SoObjects/Appointments/MSExchangeFreeBusySOAPRequest.m
Expand Up @@ -45,7 +45,7 @@ - (id) init
if ((self = [super init]))
{
address = nil;
timeZone = [NSTimeZone timeZoneWithAbbreviation: @"GMT"];
timeZone = [NSTimeZone timeZoneForSecondsFromGMT: 0];
[timeZone retain];
startDate = nil;
endDate = nil;
Expand Down
4 changes: 2 additions & 2 deletions UI/MainUI/SOGoRootPage.m
Expand Up @@ -112,7 +112,7 @@ - (WOCookie *) _cookieWithUsername: (NSString *) username

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

Expand Down
4 changes: 2 additions & 2 deletions UI/MainUI/SOGoSAML2Actions.m
Expand Up @@ -98,7 +98,7 @@ - (WOResponse *) saml2SingleLogoutServiceAction
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.
Expand Down Expand Up @@ -151,7 +151,7 @@ - (WOCookie *) _authLocationResetCookieWithName: (NSString *) cookieName
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;
Expand Down
2 changes: 1 addition & 1 deletion UI/MainUI/SOGoUserHomePage.m
Expand Up @@ -434,7 +434,7 @@ - (WOCookie *) _logoutCookieWithDate: (NSCalendarDate *) date
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.
Expand Down

0 comments on commit 2b33d45

Please sign in to comment.