adium 5833:f8377dc01eda: Guard against rotating logs multiple ti...

commits at adium.im commits at adium.im
Fri Jan 17 01:18:47 UTC 2014


details:	http://hg.adium.im/adium/rev/f8377dc01eda
revision:	5833:f8377dc01eda
branch:		adium-1.6
author:		Frank Dowsett <wixardy at adium.im>
date:		Thu Jan 16 20:08:45 2014 -0500

Guard against rotating logs multiple times before they're supposed to be due to either NSTimer or system clock changes.

E.g. making new transcripts at 23:59:45 and then again at 00:00:00.

diffs (16 lines):

diff -r d9522725cf90 -r f8377dc01eda Source/AILoggerPlugin.m
--- a/Source/AILoggerPlugin.m	Sun Jan 12 12:45:10 2014 +0100
+++ b/Source/AILoggerPlugin.m	Thu Jan 16 20:08:45 2014 -0500
@@ -1347,6 +1347,12 @@
 
 - (void)rotateLogs:(NSTimer *)timer
 {
+	//NSTimer can fire early (and later, but that's okay); reschedule the timer
+	if ([logRotateTimer.fireDate timeIntervalSinceNow] > 0.0) {
+		[logRotateTimer setFireDate:[NSDate midnightTomorrow]];
+		return;
+	}
+	
 	for (AIChat *chat in adium.chatController.openChats) {
 		AIXMLAppender *oldAppender = [self _existingAppenderForChat:chat];
 		if (!oldAppender)




More information about the commits mailing list