ObjFW  Check-in [1164147eec]

Overview
Comment:OFTimer: Keep the original interval on overrun
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1164147eecbece2379d9516d845a9ff1abf95c026d79366b0804ba9735cd610d
User & Date: js on 2017-08-11 21:02:54
Other Links: manifest | tags
Context
2017-08-11
22:15
Fix compilation with GCC check-in: 327ce49bc3 user: js tags: trunk
21:02
OFTimer: Keep the original interval on overrun check-in: 1164147eec user: js tags: trunk
20:15
scrypt: Minor code formatting fix check-in: 86ad296bec user: js tags: trunk
Changes

Modified src/OFTimer.m from [31ff560703] to [ce12a725d9].

361
362
363
364
365
366
367











368

369
370

371
372
373
374
375
376
377
378
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378

379
380

381

382
383
384
385
386
387
388







+
+
+
+
+
+
+
+
+
+
+
-
+

-
+
-







	id target = [[_target retain] autorelease];
	id object1 = [[_object1 retain] autorelease];
	id object2 = [[_object2 retain] autorelease];

	OF_ENSURE(_arguments <= 2);

	if (_repeats && _valid) {
		int missedIntervals =
		    -[_fireDate timeIntervalSinceNow] / _interval;
		of_time_interval_t newFireDate;

		/* In case the clock was changed backwards */
		if (missedIntervals < 0)
			missedIntervals = 0;

		newFireDate = [_fireDate timeIntervalSince1970] +
		    (missedIntervals + 1) * _interval;

		OFDate *old = _fireDate;
		[_fireDate release];
		_fireDate = [[OFDate alloc]
		    initWithTimeIntervalSinceNow: _interval];
		    initWithTimeIntervalSince1970: newFireDate];
		[old release];

		[[OFRunLoop currentRunLoop] addTimer: self];
	} else
		[self invalidate];

#ifdef OF_HAVE_BLOCKS
	if (_block != NULL)