<commit_before># MyLilTimer

`MyLilTimer` is a Cocoa timer class for iOS and Mac OS X. Its only dependency is the Foundation framework. `MyLilTimer` has an interface similar to `NSTimer`, while also providing a choice of three behaviors (three different clocks).

## Behaviors

### MyLilTimerBehaviorHourglass (MyLilTimerClockBoottime)

The timer fires after an interval has elapsed, regardless of system clock changes and system sleep. This is the behavior people often expect from `NSTimer`, and it appears to have this behavior **when running under Xcode** (or when the device is plugged in at all).

### MyLilTimerBehaviorPauseOnSystemSleep (MyLilTimerClockMonotonic)

The timer fires after the system has run for some duration; this is paused while the operating system was asleep. This is the **actual** behavior of `NSTimer` — an iOS device will sleep when unplugged from power, the screen is locked, and no apps are keeping it awake.

This behavior is appropriate for measuring the speed of long-running operations, such as “3 of 7 items processed, 30 seconds remaining”.

### MyLilTimerBehaviorObeySystemClockChanges (MyLilTimerClockRealtime)

The timer fires when the time on the system clock passes the fire date. This behavior is appropriate for an alarm that fires when the clock shows a particular time.


## Use

Simply add `MyLilTimer.h` and `MyLilTimer.m` to your project file.

The most common way to set a timer is with the class convenience method:

    +[MyLilTimer scheduledTimerWithBehavior:(MyLilTimerBehavior)behavior
                               timeInterval:(NSTimeInterval)intervalSinceNow
                                     target:(id)target
                                   selector:(SEL)action
                                   userInfo:(id)userInfo]

The `TimerTest` iPhone / iPad app demonstrates the use of `MyLilTimer`, along with all three behaviors.


## NSTimer features not (yet) supported

- Repeating timers
- Changing the fire date
- Use on run loops other than the main run loop (including background threads)<commit_msg>Clarify NSTimer sleeping<commit_after># MyLilTimer

`MyLilTimer` is a Cocoa timer class for iOS and Mac OS X. Its only dependency is the Foundation framework. `MyLilTimer` has an interface similar to `NSTimer`, while also providing a choice of three behaviors (three different clocks).

## Behaviors

### MyLilTimerBehaviorHourglass (MyLilTimerClockBoottime)

The timer fires after an interval has elapsed, regardless of system clock changes and system sleep. This is the behavior people often expect from `NSTimer`, and it appears to have this behavior **when running under Xcode** (and when an iOS device is plugged in to power).

### MyLilTimerBehaviorPauseOnSystemSleep (MyLilTimerClockMonotonic)

The timer fires after the system has run for some duration; this is paused while the operating system was asleep. This is the **actual** behavior of `NSTimer` — an iOS device will sleep when unplugged from power, the screen is locked, and no apps are keeping it awake.

This behavior is appropriate for measuring the speed of long-running operations, such as “3 of 7 items processed, 30 seconds remaining”.

### MyLilTimerBehaviorObeySystemClockChanges (MyLilTimerClockRealtime)

The timer fires when the time on the system clock passes the fire date. This behavior is appropriate for an alarm that fires when the clock shows a particular time.


## Use

Simply add `MyLilTimer.h` and `MyLilTimer.m` to your project file.

The most common way to set a timer is with the class convenience method:

    +[MyLilTimer scheduledTimerWithBehavior:(MyLilTimerBehavior)behavior
                               timeInterval:(NSTimeInterval)intervalSinceNow
                                     target:(id)target
                                   selector:(SEL)action
                                   userInfo:(id)userInfo]

The `TimerTest` iPhone / iPad app demonstrates the use of `MyLilTimer`, along with all three behaviors.


## NSTimer features not (yet) supported

- Repeating timers
- Changing the fire date
- Use on run loops other than the main run loop (including background threads)
{'fraction_non_alphanumeric': 0.052416446261120464, 'fraction_numerical': 0.0019235393123346958, 'mean_word_length': 3.6325167037861914, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6657510', 'n_tokens_mistral': 1064, 'n_tokens_neox': 1016, 'n_words': 520}