Index: src/OFCondition.h ================================================================== --- src/OFCondition.h +++ src/OFCondition.h @@ -45,11 +45,11 @@ * @ref broadcast or the timeout is reached. * * @param timeInterval The time interval until the timeout is reached * @return Whether the condition has been signaled */ -- (bool)waitForTimeInterval: (double)timeInterval; +- (bool)waitForTimeInterval: (of_time_interval_t)timeInterval; /*! * @brief Blocks the current thread until another thread calls @ref signal, * @ref broadcast or the timeout is reached. * Index: src/OFCondition.m ================================================================== --- src/OFCondition.m +++ src/OFCondition.m @@ -61,11 +61,11 @@ if (!of_condition_wait(&_condition, &_mutex)) @throw [OFConditionWaitFailedException exceptionWithCondition: self]; } -- (bool)waitForTimeInterval: (double)timeInterval +- (bool)waitForTimeInterval: (of_time_interval_t)timeInterval { return of_condition_timed_wait(&_condition, &_mutex, timeInterval); } - (bool)waitUntilDate: (OFDate*)date Index: src/OFDate.h ================================================================== --- src/OFDate.h +++ src/OFDate.h @@ -23,11 +23,11 @@ /*! * @brief A class for storing, accessing and comparing dates. */ @interface OFDate: OFObject { - double _seconds; + of_time_interval_t _seconds; } /*! * @brief Creates a new OFDate with the current date and time. * @@ -40,19 +40,19 @@ * 1970-01-01T00:00:00Z. * * @param seconds The seconds since 1970-01-01T00:00:00Z * @return A new, autoreleased OFDate with the specified date and time */ -+ (instancetype)dateWithTimeIntervalSince1970: (double)seconds; ++ (instancetype)dateWithTimeIntervalSince1970: (of_time_interval_t)seconds; /*! * @brief Creates a new OFDate with the specified date and time since now. * * @param seconds The seconds since now * @return A new, autoreleased OFDate with the specified date and time */ -+ (instancetype)dateWithTimeIntervalSinceNow: (double)seconds; ++ (instancetype)dateWithTimeIntervalSinceNow: (of_time_interval_t)seconds; /*! * @brief Creates a new OFDate with the specified string in the specified * format. * @@ -110,20 +110,20 @@ * time since 1970-01-01T00:00:00Z. * * @param seconds The seconds since 1970-01-01T00:00:00Z * @return An initialized OFDate with the specified date and time */ -- initWithTimeIntervalSince1970: (double)seconds; +- initWithTimeIntervalSince1970: (of_time_interval_t)seconds; /*! * @brief Initializes an already allocated OFDate with the specified date and * time since now. * * @param seconds The seconds since now * @return An initialized OFDate with the specified date and time */ -- initWithTimeIntervalSinceNow: (double)seconds; +- initWithTimeIntervalSinceNow: (of_time_interval_t)seconds; /*! * @brief Initializes an already allocated OFDate with the specified string in * the specified format. * @@ -309,30 +309,30 @@ /*! * @brief Returns the seconds since 1970-01-01T00:00:00Z. * * @return The seconds since 1970-01-01T00:00:00Z */ -- (double)timeIntervalSince1970; +- (of_time_interval_t)timeIntervalSince1970; /*! * @brief Returns the seconds the receiver is after the date. * * @param otherDate Date date to generate the difference with receiver * @return The seconds the receiver is after the date. */ -- (double)timeIntervalSinceDate: (OFDate*)otherDate; +- (of_time_interval_t)timeIntervalSinceDate: (OFDate*)otherDate; /*! * @brief Returns the seconds the receiver is in the future. * * @return The seconds the receiver is in the future */ -- (double)timeIntervalSinceNow; +- (of_time_interval_t)timeIntervalSinceNow; /*! * @brief Creates a new date with the specified time interval added. * * @param seconds The seconds after the date * @return A new, autoreleased OFDate */ -- (OFDate*)dateByAddingTimeInterval: (double)seconds; +- (OFDate*)dateByAddingTimeInterval: (of_time_interval_t)seconds; @end Index: src/OFDate.m ================================================================== --- src/OFDate.m +++ src/OFDate.m @@ -161,17 +161,17 @@ + (instancetype)date { return [[[self alloc] init] autorelease]; } -+ (instancetype)dateWithTimeIntervalSince1970: (double)seconds ++ (instancetype)dateWithTimeIntervalSince1970: (of_time_interval_t)seconds { return [[[self alloc] initWithTimeIntervalSince1970: seconds] autorelease]; } -+ (instancetype)dateWithTimeIntervalSinceNow: (double)seconds ++ (instancetype)dateWithTimeIntervalSinceNow: (of_time_interval_t)seconds { return [[[self alloc] initWithTimeIntervalSinceNow: seconds] autorelease]; } @@ -208,25 +208,25 @@ self = [super init]; OF_ENSURE(gettimeofday(&t, NULL) == 0); _seconds = t.tv_sec; - _seconds += (double)t.tv_usec / 1000000; + _seconds += (of_time_interval_t)t.tv_usec / 1000000; return self; } -- initWithTimeIntervalSince1970: (double)seconds +- initWithTimeIntervalSince1970: (of_time_interval_t)seconds { self = [super init]; _seconds = seconds; return self; } -- initWithTimeIntervalSinceNow: (double)seconds +- initWithTimeIntervalSinceNow: (of_time_interval_t)seconds { self = [self init]; _seconds += seconds; @@ -606,33 +606,33 @@ return [[otherDate retain] autorelease]; return [[self retain] autorelease]; } -- (double)timeIntervalSince1970 +- (of_time_interval_t)timeIntervalSince1970 { return _seconds; } -- (double)timeIntervalSinceDate: (OFDate*)otherDate +- (of_time_interval_t)timeIntervalSinceDate: (OFDate*)otherDate { return _seconds - otherDate->_seconds; } -- (double)timeIntervalSinceNow +- (of_time_interval_t)timeIntervalSinceNow { struct timeval t; - double seconds; + of_time_interval_t seconds; OF_ENSURE(!gettimeofday(&t, NULL)); seconds = t.tv_sec; - seconds += (double)t.tv_usec / 1000000; + seconds += (of_time_interval_t)t.tv_usec / 1000000; return _seconds - seconds; } -- (OFDate*)dateByAddingTimeInterval: (double)seconds +- (OFDate*)dateByAddingTimeInterval: (of_time_interval_t)seconds { return [OFDate dateWithTimeIntervalSince1970: _seconds + seconds]; } @end Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -188,10 +188,15 @@ size_t location; /*! The length of the range */ size_t length; } of_range_t; +/*! + * @brief A time interval in seconds. + */ +typedef double of_time_interval_t; + /*! * @brief A point. */ typedef struct of_point_t { /*! The x coordinate of the point */ @@ -730,11 +735,11 @@ * * @param selector The selector to perform * @param delay The delay after which the selector will be performed */ - (void)performSelector: (SEL)selector - afterDelay: (double)delay; + afterDelay: (of_time_interval_t)delay; /*! * @brief Performs the specified selector with the specified object after the * specified delay. * @@ -743,11 +748,11 @@ * selector * @param delay The delay after which the selector will be performed */ - (void)performSelector: (SEL)selector withObject: (id)object - afterDelay: (double)delay; + afterDelay: (of_time_interval_t)delay; /*! * @brief Performs the specified selector with the specified objects after the * specified delay. * @@ -759,11 +764,11 @@ * @param delay The delay after which the selector will be performed */ - (void)performSelector: (SEL)selector withObject: (id)object1 withObject: (id)object2 - afterDelay: (double)delay; + afterDelay: (of_time_interval_t)delay; #ifdef OF_HAVE_THREADS /*! * @brief Performs the specified selector on the specified thread. * @@ -854,11 +859,11 @@ * @param thread The thread on which to perform the selector * @param delay The delay after which the selector will be performed */ - (void)performSelector: (SEL)selector onThread: (OFThread*)thread - afterDelay: (double)delay; + afterDelay: (of_time_interval_t)delay; /*! * @brief Performs the specified selector on the specified thread with the * specified object after the specified delay. * @@ -869,11 +874,11 @@ * @param delay The delay after which the selector will be performed */ - (void)performSelector: (SEL)selector onThread: (OFThread*)thread withObject: (id)object - afterDelay: (double)delay; + afterDelay: (of_time_interval_t)delay; /*! * @brief Performs the specified selector on the specified thread with the * specified objects after the specified delay. * @@ -887,11 +892,11 @@ */ - (void)performSelector: (SEL)selector onThread: (OFThread*)thread withObject: (id)object1 withObject: (id)object2 - afterDelay: (double)delay; + afterDelay: (of_time_interval_t)delay; #endif /*! * @brief This method is called when @ref resolveClassMethod: or * @ref resolveInstanceMethod: returned false. It should return a target Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -564,11 +564,11 @@ return objc_msgSend(self, selector, object1, object2); #endif } - (void)performSelector: (SEL)selector - afterDelay: (double)delay + afterDelay: (of_time_interval_t)delay { void *pool = objc_autoreleasePoolPush(); [OFTimer scheduledTimerWithTimeInterval: delay target: self @@ -578,11 +578,11 @@ objc_autoreleasePoolPop(pool); } - (void)performSelector: (SEL)selector withObject: (id)object - afterDelay: (double)delay + afterDelay: (of_time_interval_t)delay { void *pool = objc_autoreleasePoolPush(); [OFTimer scheduledTimerWithTimeInterval: delay target: self @@ -594,11 +594,11 @@ } - (void)performSelector: (SEL)selector withObject: (id)object1 withObject: (id)object2 - afterDelay: (double)delay + afterDelay: (of_time_interval_t)delay { void *pool = objc_autoreleasePoolPush(); [OFTimer scheduledTimerWithTimeInterval: delay target: self @@ -722,11 +722,11 @@ objc_autoreleasePoolPop(pool); } - (void)performSelector: (SEL)selector onThread: (OFThread*)thread - afterDelay: (double)delay + afterDelay: (of_time_interval_t)delay { void *pool = objc_autoreleasePoolPush(); [[thread runLoop] addTimer: [OFTimer timerWithTimeInterval: delay target: self @@ -737,11 +737,11 @@ } - (void)performSelector: (SEL)selector onThread: (OFThread*)thread withObject: (id)object - afterDelay: (double)delay + afterDelay: (of_time_interval_t)delay { void *pool = objc_autoreleasePoolPush(); [[thread runLoop] addTimer: [OFTimer timerWithTimeInterval: delay target: self @@ -754,11 +754,11 @@ - (void)performSelector: (SEL)selector onThread: (OFThread*)thread withObject: (id)object1 withObject: (id)object2 - afterDelay: (double)delay + afterDelay: (of_time_interval_t)delay { void *pool = objc_autoreleasePoolPush(); [[thread runLoop] addTimer: [OFTimer timerWithTimeInterval: delay target: self Index: src/OFRunLoop.m ================================================================== --- src/OFRunLoop.m +++ src/OFRunLoop.m @@ -672,11 +672,12 @@ } #endif /* Watch for stream events until the next timer is due */ if (nextTimer != nil) { - double timeout = [nextTimer timeIntervalSinceNow]; + of_time_interval_t timeout = + [nextTimer timeIntervalSinceNow]; if (timeout > 0) { #if defined(OF_HAVE_SOCKETS) [_streamObserver observeForTimeInterval: timeout]; Index: src/OFStreamObserver.h ================================================================== --- src/OFStreamObserver.h +++ src/OFStreamObserver.h @@ -186,11 +186,11 @@ * timeout is reached. * * @param timeInterval The time to wait for an event, in seconds * @return A boolean whether events occurred during the timeinterval */ -- (bool)observeForTimeInterval: (double)timeInterval; +- (bool)observeForTimeInterval: (of_time_interval_t)timeInterval; /*! * @brief Observes all streams until an event happens on a stream or the * timeout is reached. * Index: src/OFStreamObserver.m ================================================================== --- src/OFStreamObserver.m +++ src/OFStreamObserver.m @@ -391,11 +391,11 @@ - (void)observe { [self observeForTimeInterval: -1]; } -- (bool)observeForTimeInterval: (double)timeInterval +- (bool)observeForTimeInterval: (of_time_interval_t)timeInterval { OF_UNRECOGNIZED_SELECTOR } - (bool)observeUntilDate: (OFDate*)date Index: src/OFStreamObserver_kqueue.m ================================================================== --- src/OFStreamObserver_kqueue.m +++ src/OFStreamObserver_kqueue.m @@ -106,11 +106,11 @@ EV_SET(&event, fd, EVFILT_WRITE, EV_DELETE, 0, 0, 0); [_changeList addItem: &event]; } -- (bool)observeForTimeInterval: (double)timeInterval +- (bool)observeForTimeInterval: (of_time_interval_t)timeInterval { void *pool = objc_autoreleasePoolPush(); struct timespec timeout; struct kevent eventList[EVENTLIST_SIZE]; int i, events, realEvents = 0; Index: src/OFStreamObserver_poll.m ================================================================== --- src/OFStreamObserver_poll.m +++ src/OFStreamObserver_poll.m @@ -133,11 +133,11 @@ { [self OF_removeFileDescriptor: fd withEvents: POLLOUT]; } -- (bool)observeForTimeInterval: (double)timeInterval +- (bool)observeForTimeInterval: (of_time_interval_t)timeInterval { void *pool = objc_autoreleasePoolPush(); struct pollfd *FDs; size_t i, nFDs, realEvents = 0; Index: src/OFStreamObserver_select.m ================================================================== --- src/OFStreamObserver_select.m +++ src/OFStreamObserver_select.m @@ -72,11 +72,11 @@ if (!FD_ISSET(fd, &_readFDs)) FD_CLR(fd, &_exceptFDs); } -- (bool)observeForTimeInterval: (double)timeInterval +- (bool)observeForTimeInterval: (of_time_interval_t)timeInterval { void *pool = objc_autoreleasePoolPush(); OFStream **objects; fd_set readFDs; fd_set writeFDs; Index: src/OFThread.h ================================================================== --- src/OFThread.h +++ src/OFThread.h @@ -120,13 +120,13 @@ /*! * @brief Suspends execution of the current thread for the specified time * interval. * - * @param seconds The number of seconds to sleep + * @param timeInterval The number of seconds to sleep */ -+ (void)sleepForTimeInterval: (double)seconds; ++ (void)sleepForTimeInterval: (of_time_interval_t)timeInterval; /*! * @brief Suspends execution of the current thread until the specified date. * * @param date The date to wait for Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -173,36 +173,37 @@ return thread->_threadDictionary; } #endif -+ (void)sleepForTimeInterval: (double)seconds ++ (void)sleepForTimeInterval: (of_time_interval_t)timeInterval { - if (seconds < 0) + if (timeInterval < 0) @throw [OFOutOfRangeException exception]; #if defined(_WIN32) - if (seconds * 1000 > UINT_MAX) + if (timeInterval * 1000 > UINT_MAX) @throw [OFOutOfRangeException exception]; - Sleep((unsigned int)(seconds * 1000)); + Sleep((unsigned int)(timeInterval * 1000)); #elif defined(HAVE_NANOSLEEP) struct timespec rqtp; - rqtp.tv_sec = (time_t)seconds; - rqtp.tv_nsec = lrint((seconds - rqtp.tv_sec) * 1000000000); + rqtp.tv_sec = (time_t)timeInterval; + rqtp.tv_nsec = lrint((timeInterval - rqtp.tv_sec) * 1000000000); - if (rqtp.tv_sec != floor(seconds)) + if (rqtp.tv_sec != floor(timeInterval)) @throw [OFOutOfRangeException exception]; nanosleep(&rqtp, NULL); #else - if (seconds > UINT_MAX) + if (timeInterval > UINT_MAX) @throw [OFOutOfRangeException exception]; - sleep((unsigned int)seconds); - usleep((useconds_t)lrint((seconds - floor(seconds)) * 1000000)); + sleep((unsigned int)timeInterval); + usleep((useconds_t)lrint( + (timeInterval - floor(timeInterval)) * 1000000)); #endif } + (void)sleepUntilDate: (OFDate*)date { Index: src/OFTimer.h ================================================================== --- src/OFTimer.h +++ src/OFTimer.h @@ -38,11 +38,11 @@ * @brief A class for creating and firing timers. */ @interface OFTimer: OFObject { OFDate *_fireDate; - double _interval; + of_time_interval_t _interval; id _target, _object1, _object2; SEL _selector; uint8_t _arguments; bool _repeats; #ifdef OF_HAVE_BLOCKS @@ -61,54 +61,51 @@ #endif /*! * @brief Creates and schedules a new timer with the specified time interval. * - * @param interval The time interval after which the timer should be executed - * when fired + * @param timeInterval The time interval after which the timer should be fired * @param target The target on which to call the selector * @param selector The selector to call on the target * @param repeats Whether the timer repeats after it has been executed * @return A new, autoreleased timer */ -+ (instancetype)scheduledTimerWithTimeInterval: (double)interval ++ (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval target: (id)target selector: (SEL)selector repeats: (bool)repeats; /*! * @brief Creates and schedules a new timer with the specified time interval. * - * @param interval The time interval after which the timer should be executed - * when fired + * @param timeInterval The time interval after which the timer should be fired * @param target The target on which to call the selector * @param selector The selector to call on the target * @param object An object to pass when calling the selector on the target * @param repeats Whether the timer repeats after it has been executed * @return A new, autoreleased timer */ -+ (instancetype)scheduledTimerWithTimeInterval: (double)interval ++ (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval target: (id)target selector: (SEL)selector object: (id)object repeats: (bool)repeats; /*! * @brief Creates and schedules a new timer with the specified time interval. * - * @param interval The time interval after which the timer should be executed - * when fired + * @param timeInterval The time interval after which the timer should be fired * @param target The target on which to call the selector * @param selector The selector to call on the target * @param object1 The first object to pass when calling the selector on the * target * @param object2 The second object to pass when calling the selector on the * target * @param repeats Whether the timer repeats after it has been executed * @return A new, autoreleased timer */ -+ (instancetype)scheduledTimerWithTimeInterval: (double)interval ++ (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 repeats: (bool)repeats; @@ -115,68 +112,64 @@ #ifdef OF_HAVE_BLOCKS /*! * @brief Creates and schedules a new timer with the specified time interval. * - * @param interval The time interval after which the timer should be executed - * when fired + * @param timeInterval The time interval after which the timer should be fired * @param repeats Whether the timer repeats after it has been executed * @param block The block to invoke when the timer fires * @return A new, autoreleased timer */ -+ (instancetype)scheduledTimerWithTimeInterval: (double)interval ++ (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval repeats: (bool)repeats block: (of_timer_block_t)block; #endif /*! * @brief Creates a new timer with the specified time interval. * - * @param interval The time interval after which the timer should be executed - * when fired + * @param timeInterval The time interval after which the timer should be fired * @param target The target on which to call the selector * @param selector The selector to call on the target * @param repeats Whether the timer repeats after it has been executed * @return A new, autoreleased timer */ -+ (instancetype)timerWithTimeInterval: (double)interval ++ (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval target: (id)target selector: (SEL)selector repeats: (bool)repeats; /*! * @brief Creates a new timer with the specified time interval. * - * @param interval The time interval after which the timer should be executed - * when fired + * @param timeInterval The time interval after which the timer should be fired * @param target The target on which to call the selector * @param selector The selector to call on the target * @param object An object to pass when calling the selector on the target * @param repeats Whether the timer repeats after it has been executed * @return A new, autoreleased timer */ -+ (instancetype)timerWithTimeInterval: (double)interval ++ (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval target: (id)target selector: (SEL)selector object: (id)object repeats: (bool)repeats; /*! * @brief Creates a new timer with the specified time interval. * - * @param interval The time interval after which the timer should be executed - * when fired + * @param timeInterval The time interval after which the timer should be fired * @param target The target on which to call the selector * @param selector The selector to call on the target * @param object1 The first object to pass when calling the selector on the * target * @param object2 The second object to pass when calling the selector on the * target * @param repeats Whether the timer repeats after it has been executed * @return A new, autoreleased timer */ -+ (instancetype)timerWithTimeInterval: (double)interval ++ (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 repeats: (bool)repeats; @@ -183,17 +176,16 @@ #ifdef OF_HAVE_BLOCKS /*! * @brief Creates a new timer with the specified time interval. * - * @param interval The time interval after which the timer should be executed - * when fired + * @param timeInterval The time interval after which the timer should be fired * @param repeats Whether the timer repeats after it has been executed * @param block The block to invoke when the timer fires * @return A new, autoreleased timer */ -+ (instancetype)timerWithTimeInterval: (double)interval ++ (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval repeats: (bool)repeats block: (of_timer_block_t)block; #endif /*! @@ -207,11 +199,11 @@ * @param selector The selector to call on the target * @param repeats Whether the timer repeats after it has been executed * @return An initialized timer */ - initWithFireDate: (OFDate*)fireDate - interval: (double)interval + interval: (of_time_interval_t)interval target: (id)target selector: (SEL)selector repeats: (bool)repeats; /*! @@ -226,11 +218,11 @@ * @param object An object to pass when calling the selector on the target * @param repeats Whether the timer repeats after it has been executed * @return An initialized timer */ - initWithFireDate: (OFDate*)fireDate - interval: (double)interval + interval: (of_time_interval_t)interval target: (id)target selector: (SEL)selector object: (id)object repeats: (bool)repeats; @@ -249,11 +241,11 @@ * target * @param repeats Whether the timer repeats after it has been executed * @return An initialized timer */ - initWithFireDate: (OFDate*)fireDate - interval: (double)interval + interval: (of_time_interval_t)interval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 repeats: (bool)repeats; @@ -269,11 +261,11 @@ * @param repeats Whether the timer repeats after it has been executed * @param block The block to invoke when the timer fires * @return An initialized timer */ - initWithFireDate: (OFDate*)fireDate - interval: (double)interval + interval: (of_time_interval_t)interval repeats: (bool)repeats block: (of_timer_block_t)block; #endif /*! @@ -318,14 +310,14 @@ * repeating timer. * * @return The time interval in which the timer will repeat, if it is a * repeating timer */ -- (double)timeInterval; +- (of_time_interval_t)timeInterval; #ifdef OF_HAVE_THREADS /*! * @brief Waits until the timer fired. */ - (void)waitUntilDone; #endif @end Index: src/OFTimer.m ================================================================== --- src/OFTimer.m +++ src/OFTimer.m @@ -33,19 +33,19 @@ #import "autorelease.h" #import "macros.h" @implementation OFTimer -+ (instancetype)scheduledTimerWithTimeInterval: (double)interval ++ (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval target: (id)target selector: (SEL)selector repeats: (bool)repeats { void *pool = objc_autoreleasePoolPush(); - OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: interval]; + OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: timeInterval]; id timer = [[[self alloc] initWithFireDate: fireDate - interval: interval + interval: timeInterval target: target selector: selector repeats: repeats] autorelease]; [[OFRunLoop currentRunLoop] addTimer: timer]; @@ -54,20 +54,20 @@ objc_autoreleasePoolPop(pool); return [timer autorelease]; } -+ (instancetype)scheduledTimerWithTimeInterval: (double)interval ++ (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval target: (id)target selector: (SEL)selector object: (id)object repeats: (bool)repeats { void *pool = objc_autoreleasePoolPush(); - OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: interval]; + OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: timeInterval]; id timer = [[[self alloc] initWithFireDate: fireDate - interval: interval + interval: timeInterval target: target selector: selector object: object repeats: repeats] autorelease]; @@ -77,21 +77,21 @@ objc_autoreleasePoolPop(pool); return [timer autorelease]; } -+ (instancetype)scheduledTimerWithTimeInterval: (double)interval ++ (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 repeats: (bool)repeats { void *pool = objc_autoreleasePoolPush(); - OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: interval]; + OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: timeInterval]; id timer = [[[self alloc] initWithFireDate: fireDate - interval: interval + interval: timeInterval target: target selector: selector object: object1 object: object2 repeats: repeats] autorelease]; @@ -103,18 +103,18 @@ return [timer autorelease]; } #ifdef OF_HAVE_BLOCKS -+ (instancetype)scheduledTimerWithTimeInterval: (double)interval ++ (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval repeats: (bool)repeats block: (of_timer_block_t)block { void *pool = objc_autoreleasePoolPush(); - OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: interval]; + OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: timeInterval]; id timer = [[[self alloc] initWithFireDate: fireDate - interval: interval + interval: timeInterval repeats: repeats block: block] autorelease]; [[OFRunLoop currentRunLoop] addTimer: timer]; @@ -123,19 +123,19 @@ return [timer autorelease]; } #endif -+ (instancetype)timerWithTimeInterval: (double)interval ++ (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval target: (id)target selector: (SEL)selector repeats: (bool)repeats { void *pool = objc_autoreleasePoolPush(); - OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: interval]; + OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: timeInterval]; id timer = [[[self alloc] initWithFireDate: fireDate - interval: interval + interval: timeInterval target: target selector: selector repeats: repeats] autorelease]; [timer retain]; @@ -142,20 +142,20 @@ objc_autoreleasePoolPop(pool); return [timer autorelease]; } -+ (instancetype)timerWithTimeInterval: (double)interval ++ (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval target: (id)target selector: (SEL)selector object: (id)object repeats: (bool)repeats { void *pool = objc_autoreleasePoolPush(); - OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: interval]; + OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: timeInterval]; id timer = [[[self alloc] initWithFireDate: fireDate - interval: interval + interval: timeInterval target: target selector: selector object: object repeats: repeats] autorelease]; @@ -163,21 +163,21 @@ objc_autoreleasePoolPop(pool); return [timer autorelease]; } -+ (instancetype)timerWithTimeInterval: (double)interval ++ (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 repeats: (bool)repeats { void *pool = objc_autoreleasePoolPush(); - OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: interval]; + OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: timeInterval]; id timer = [[[self alloc] initWithFireDate: fireDate - interval: interval + interval: timeInterval target: target selector: selector object: object1 object: object2 repeats: repeats] autorelease]; @@ -187,18 +187,18 @@ return [timer autorelease]; } #ifdef OF_HAVE_BLOCKS -+ (instancetype)timerWithTimeInterval: (double)interval ++ (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval repeats: (bool)repeats block: (of_timer_block_t)block { void *pool = objc_autoreleasePoolPush(); - OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: interval]; + OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: timeInterval]; id timer = [[[self alloc] initWithFireDate: fireDate - interval: interval + interval: timeInterval repeats: repeats block: block] autorelease]; [timer retain]; objc_autoreleasePoolPop(pool); @@ -211,11 +211,11 @@ { OF_INVALID_INIT_METHOD } - (instancetype)OF_initWithFireDate: (OFDate*)fireDate - interval: (double)interval + interval: (of_time_interval_t)interval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 arguments: (uint8_t)arguments @@ -243,11 +243,11 @@ return self; } - initWithFireDate: (OFDate*)fireDate - interval: (double)interval + interval: (of_time_interval_t)interval target: (id)target selector: (SEL)selector repeats: (bool)repeats { return [self OF_initWithFireDate: fireDate @@ -259,11 +259,11 @@ arguments: 0 repeats: repeats]; } - initWithFireDate: (OFDate*)fireDate - interval: (double)interval + interval: (of_time_interval_t)interval target: (id)target selector: (SEL)selector object: (id)object repeats: (bool)repeats { @@ -276,11 +276,11 @@ arguments: 1 repeats: repeats]; } - initWithFireDate: (OFDate*)fireDate - interval: (double)interval + interval: (of_time_interval_t)interval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 repeats: (bool)repeats @@ -295,11 +295,11 @@ repeats: repeats]; } #ifdef OF_HAVE_BLOCKS - initWithFireDate: (OFDate*)fireDate - interval: (double)interval + interval: (of_time_interval_t)interval repeats: (bool)repeats block: (of_timer_block_t)block { self = [super init]; @@ -422,11 +422,11 @@ } @finally { [self release]; } } -- (double)timeInterval +- (of_time_interval_t)timeInterval { return _interval; } - (void)invalidate Index: src/threading.h ================================================================== --- src/threading.h +++ src/threading.h @@ -21,10 +21,12 @@ # error No threads available! #endif #include +#import "OFObject.h" + #import "macros.h" #if defined(OF_HAVE_PTHREADS) # include typedef pthread_t of_thread_t; @@ -222,11 +224,11 @@ #endif } static OF_INLINE bool of_condition_timed_wait(of_condition_t *condition, of_mutex_t *mutex, - double timeout) + of_time_interval_t timeout) { #if defined(OF_HAVE_PTHREADS) struct timespec ts; ts.tv_sec = (time_t)timeout;