Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSTimerMBS class.

NSTimerMBS.fireDate as date

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 10.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The date at which the receiver will fire.
Example
dim d as new date
d.hour = d.hour + 1 // start in one hour

dim n as new NSTimerMBS(d, 5, true)
MsgBox n.fireDate.ShortDate+" "+n.fireDate.ShortTime

The date at which the receiver will fire. If the timer is no longer valid, this method returns the last date at which the timer fired.

Use the isValid method to verify that the timer is valid.

You typically use this method to adjust the firing time of a repeating timer. Although resetting a timer's next firing time is a relatively expensive operation, it may be more efficient in some situations. For example, you could use it in situations where you want to repeat an action multiple times in the future, but at irregular time intervals. Adjusting the firing time of a single timer would likely incur less expense than creating multiple timer objects, scheduling each one on a run loop, and then destroying them.

You should not call this method on a timer that has been invalidated, which includes non-repeating timers that have already fired. You could potentially call this method on a non-repeating timer that had not yet fired, although you should always do so from the thread to which the timer is attached to avoid potential race conditions.
(Read and Write property)

Some examples using this property:

NSTimerMBS.fireDateTime as DateTime

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 20.5 ✅ Yes ❌ No ❌ No ✅ Yes All
The date at which the receiver will fire.

(Read and Write property)

NSTimerMBS.Handle as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 10.0 ✅ Yes ❌ No ❌ No ✅ Yes All
The internal reference to the NSTimer object.
Example
dim n as new NSTimerMBS(5, true)
MsgBox str(n.Handle)

(Read and Write property)

NSTimerMBS.isValid as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 10.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a Boolean value that indicates whether the receiver is currently valid.
Example
dim n as new NSTimerMBS(5, true)
MsgBox str(n.isValid)

True if the receiver is still capable of firing or false if the timer has been invalidated and is no longer capable of firing.
(Read only property)

NSTimerMBS.tag as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 10.0 ✅ Yes ❌ No ❌ No ✅ Yes All
A value you can use in your app however you like.
Example
dim n as new NSTimerMBS(5, true)
n.tag = window1 // some value you may later use

(Read and Write property)

NSTimerMBS.timeInterval as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 10.0 ✅ Yes ❌ No ❌ No ✅ Yes All
The receiver's time interval.
Example
dim n as new NSTimerMBS(5, true)
MsgBox str(n.timeInterval)

The receiver's time interval. If the receiver is a non-repeating timer, returns 0 (even if a time interval was set).
(Read only property)

NSTimerMBS.tolerance as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 13.5 ✅ Yes ❌ No ❌ No ✅ Yes All
The tolerance for this timer.

Requires Mac OS X 10.9.

Setting a tolerance for a timer allows it to fire later than the scheduled fire date, improving the ability of the system to optimize for increased power savings and responsiveness. The timer may fire at any time between its scheduled fire date and the scheduled fire date plus the tolerance. The timer will not fire before the scheduled fire date. For repeating timers, the next fire date is calculated from the original fire date regardless of tolerance applied at individual fire times, to avoid drift. The default value is zero, which means no additional tolerance is applied. The system reserves the right to apply a small amount of tolerance to certain timers regardless of the value of this property.

As the user of the timer, you will have the best idea of what an appropriate tolerance for a timer may be. A general rule of thumb, though, is to set the tolerance to at least 10% of the interval, for a repeating timer. Even a small amount of tolerance will have a significant positive impact on the power usage of your application. The system may put a maximum value of the tolerance.
(Read and Write property)

The items on this page are in the following plugins: MBS MacCocoa Plugin.


The biggest plugin in space...