There are no extensions or categories in the project. 
I changed the -newData: method name to -arrivalOfNewData:. 
I changed the newTimer variable name to theTimer. 
I rebooted the machine. 

No joy.

I realize this is no longer a Cocoa problem, but what - even theoretically - 
could cause this? 
As shown in the debugger, the timer gets created with the wrong time interval 
value, by a consistent factor of 20.

-Carl


> On Apr 29, 2020, at 2:24 PM, Andy Lee <ag...@earthlink.net> wrote:
> 
> I did the same just now in a macOS project.  Copied your code and added a 
> newData: method.  This is with Xcode 11.2.1 on Mojave, 10.4.6.  Works fine 
> for me.  Weird!
> 
> @implementation AppDelegate
> 
> - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
>     NSTimer *newTimer = [NSTimer timerWithTimeInterval:1.0  // should be 1/sec
>                                                 target:self
>                                               selector:@selector(newData:)
>                                               userInfo:nil
>                                                repeats:YES];
>     [[NSRunLoop mainRunLoop] addTimer:newTimer
>                               forMode:NSRunLoopCommonModes];
> }
> 
> - (void)newData:(NSTimer *)timer {
>     NSLog(@"timer is %@", timer);
> }
> 
> @end
> 
> 2020-04-29 17:20:45.331469-0400 NSTimerQuestion[21676:3985041] Metal API 
> Validation Enabled
> 2020-04-29 17:20:46.413190-0400 NSTimerQuestion[21676:3985041] timer is 
> <__NSCFTimer: 0x60000370eb80>
> 2020-04-29 17:20:47.412968-0400 NSTimerQuestion[21676:3985041] timer is 
> <__NSCFTimer: 0x60000370eb80>
> 2020-04-29 17:20:48.413525-0400 NSTimerQuestion[21676:3985041] timer is 
> <__NSCFTimer: 0x60000370eb80>
> 2020-04-29 17:20:49.413373-0400 NSTimerQuestion[21676:3985041] timer is 
> <__NSCFTimer: 0x60000370eb80>
> 2020-04-29 17:20:50.412610-0400 NSTimerQuestion[21676:3985041] timer is 
> <__NSCFTimer: 0x60000370eb80>
> ...
> 
> --Andy
> 
> On Apr 29, 2020, at 5:15 PM, Alex Zavatone via Cocoa-dev 
> <cocoa-dev@lists.apple.com <mailto:cocoa-dev@lists.apple.com>> wrote:
>> 
>> I used your code in an iOS project and it works as expected.
>> 
>> 2020-04-29 16:14:02.254107-0500 Timer[83275:13268128] Wed Apr 29 16:14:02 
>> 2020
>> 2020-04-29 16:14:03.254048-0500 Timer[83275:13268128] Wed Apr 29 16:14:03 
>> 2020
>> 2020-04-29 16:14:04.253957-0500 Timer[83275:13268128] Wed Apr 29 16:14:04 
>> 2020
>> 2020-04-29 16:14:05.254170-0500 Timer[83275:13268128] Wed Apr 29 16:14:05 
>> 2020
>> 2020-04-29 16:14:06.254490-0500 Timer[83275:13268128] Wed Apr 29 16:14:06 
>> 2020
>> 2020-04-29 16:14:07.254570-0500 Timer[83275:13268128] Wed Apr 29 16:14:07 
>> 2020
>> 2020-04-29 16:14:08.254651-0500 Timer[83275:13268128] Wed Apr 29 16:14:08 
>> 2020
>> 2020-04-29 16:14:09.253715-0500 Timer[83275:13268128] Wed Apr 29 16:14:09 
>> 2020
>> 2020-04-29 16:14:10.254741-0500 Timer[83275:13268128] Wed Apr 29 16:14:10 
>> 2020
>> 
>> I’ll mail you the project offlist.
>> 
>> 
>> 
>>> On Apr 29, 2020, at 4:07 PM, Carl Hoefs via Cocoa-dev 
>>> <cocoa-dev@lists.apple.com <mailto:cocoa-dev@lists.apple.com>> wrote:
>>> 
>>> On Apr 29, 2020, at 1:53 PM, Carl Hoefs via Cocoa-dev 
>>> <cocoa-dev@lists.apple.com <mailto:cocoa-dev@lists.apple.com>> wrote:
>>>> 
>>>> On Apr 29, 2020, at 1:43 PM, Steve Mills via Cocoa-dev 
>>>> <cocoa-dev@lists.apple.com <mailto:cocoa-dev@lists.apple.com> 
>>>> <mailto:cocoa-dev@lists.apple.com <mailto:cocoa-dev@lists.apple.com>>> 
>>>> wrote:
>>>>> 
>>>>> On Apr 29, 2020, at 15:36:23, Carl Hoefs via Cocoa-dev 
>>>>> <cocoa-dev@lists.apple.com <mailto:cocoa-dev@lists.apple.com>> wrote:
>>>>>> 
>>>>>> When I issue NSTimer's +timerWithTimeInterval::::: method, I'm getting 
>>>>>> unexpected timer firing times (20X faster than expected).
>>>>>> 
>>>>>> ∙ If I specify 1.0 for the time interval, my method gets called 20 
>>>>>> times/sec. 
>>>>>> ∙ If I specify 20.0 for the time interval, my method gets called 1 
>>>>>> time/sec.
>>>>>> ∙ If I specify 100.0 for the time interval, my method gets called 5 
>>>>>> times/sec.
>>>>>> ...etc.
>>>>>> 
>>>>>> Here is my only invocation, called once and nevermore:
>>>>>> 
>>>>>>    NSTimer *newTimer = [NSTimer timerWithTimeInterval:1.0  // should be 
>>>>>> 1/sec
>>>>>>                                                target:self
>>>>>>                                              selector:@selector(newData:)
>>>>>>                                              userInfo:nil
>>>>>>                                               repeats:YES];
>>>>>>    [[NSRunLoop mainRunLoop] addTimer:newTimer 
>>>>>>                              forMode:NSRunLoopCommonModes];
>>>>> 
>>>>> Sounds like multiple timers are being installed. Set a breakpoint that 
>>>>> logs when hit.
>>>>> 
>>>> 
>>>> On break, It's always the same timer. This is with time interval set to 
>>>> 20.0:
>>>> 
>>>> <timer id>                   <interval>       <fire date>
>>>> <__NSCFTimer: 0x60000323c600>   1.000000   Wed Apr 29 13:50:40 2020
>>>> <__NSCFTimer: 0x60000323c600>   1.000000   Wed Apr 29 13:50:41 2020
>>>> <__NSCFTimer: 0x60000323c600>   1.000000   Wed Apr 29 13:50:42 2020
>>>> . . .
>>>> 
>>> 
>>> I put a break directly after the creation of the timer, and introspection 
>>> already shows the wrong value for the time interval! And since 
>>> .timeInterval is a readonly attribute, I cannot force it to the correct 
>>> value, nor is there a -setTimeInterval: method.
>>> 
>>> Argh...
>>> -Carl
>>> 
>>> 
>>> _______________________________________________
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
>>> <mailto:Cocoa-dev@lists.apple.com>)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com 
>>> <http://lists.apple.com/>
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com 
>>> <https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com>
>>> 
>>> This email sent to z...@mac.com
>> 
>> _______________________________________________
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
>> <mailto:Cocoa-dev@lists.apple.com>)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com 
>> <http://lists.apple.com/>
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com 
>> <https://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com>
>> 
>> This email sent to ag...@mac.com
> 

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to