mirror of
https://github.com/transmission/transmission
synced 2025-02-03 21:12:05 +00:00
when setting up the speed limit timer, create the fire date using the user's default calendar
This commit is contained in:
parent
c6d0d4ced9
commit
d129975858
1 changed files with 2 additions and 4 deletions
|
@ -2345,13 +2345,12 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
if (![fDefaults boolForKey: @"SpeedLimitAuto"])
|
||||
return;
|
||||
|
||||
NSCalendar * calendar = [[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar];
|
||||
NSCalendar * calendar = [NSCalendar currentCalendar];
|
||||
NSDateComponents * nowComponents = [calendar components: NSHourCalendarUnit | NSMinuteCalendarUnit fromDate: [NSDate date]],
|
||||
* onComponents = [calendar components: NSHourCalendarUnit | NSMinuteCalendarUnit
|
||||
fromDate: [fDefaults objectForKey: @"SpeedLimitAutoOnDate"]],
|
||||
* offComponents = [calendar components: NSHourCalendarUnit | NSMinuteCalendarUnit
|
||||
fromDate: [fDefaults objectForKey: @"SpeedLimitAutoOffDate"]];
|
||||
[calendar release];
|
||||
|
||||
//check if should be on if within range
|
||||
int onTime = [onComponents hour] * 60 + [onComponents minute],
|
||||
|
@ -2399,7 +2398,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
NSDate * timerDate = [fDefaults objectForKey: nextIsLimit ? @"SpeedLimitAutoOnDate" : @"SpeedLimitAutoOffDate"];
|
||||
|
||||
//create date with combination of the current date and the date to go off
|
||||
NSCalendar * calendar = [[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar];
|
||||
NSCalendar * calendar = [NSCalendar currentCalendar];
|
||||
NSDateComponents * nowComponents = [calendar components: NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit
|
||||
| NSHourCalendarUnit | NSMinuteCalendarUnit fromDate: [NSDate date]],
|
||||
* timerComponents = [calendar components: NSHourCalendarUnit | NSMinuteCalendarUnit fromDate: timerDate];
|
||||
|
@ -2415,7 +2414,6 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
[nowComponents setSecond: 0];
|
||||
|
||||
NSDate * dateToUse = [calendar dateFromComponents: nowComponents];
|
||||
[calendar release];
|
||||
|
||||
fSpeedLimitTimer = [[NSTimer alloc] initWithFireDate: dateToUse interval: 0 target: self selector: @selector(autoSpeedLimit:)
|
||||
userInfo: [NSNumber numberWithBool: nextIsLimit] repeats: NO];
|
||||
|
|
Loading…
Reference in a new issue