Timer and Dispatcher Timer in Emulator vs. Device - windows-phone-7.1

I need to use a timer in my WP7 application and display it's value in the UI.
I managed to get it working two ways: one using the DispatcherTimer class and the other using the Timer class.
The problem is that the DispatcherTimer is slower than "real-time" and the Timer class actually goes faster than "real-time". So both go wrong.
Is this because I'm running it in the emulator? Don't have a device to test it on. Anyone had this issue and tested on both?

To show time accurate to one second on screen, I use a DispatcherTimer that updates every 500 milliseconds and then subtract the current time from the start time to get the time elapsed and display that on-screen.
Does that help?

Related

CMClock Swift Example

I have two iOS devices physically separate from each other. I need them to perform a task at exactly the top of every minute and bottom of every minute (so every 30 seconds) and stay synchronized.
My initial approach was to calculate the time until the top of the next minute and set a timer until that time and then start my 30 second timer.
The problem was that the 30 second timer would drift and eventually be out of sync.
I discovered an Apple API called CMClock. I could not find an example but was wondering if anyone has used this API and if so could provide an example of how to keep two devices synchronized like I described?

Application shown but not responsive for up to 5 seconds prior to calling applicationWillEnterForeground

While attempting to optimize load speed I started placing timers in different places and looking at the performance. The app uses OpenGL and Core Data and has a decent amount of screens and artwork.
But the largest part of the lag seems to be taking place prior to applicationWillEnterForeground (assuming it's not a cold load)
The app shows up and is displayed and the UI is unresponsive for close to 5 seconds. I start a timer and print a time as soon as I can press a button. The time between applicationWillEnterForeground and when I can press the button is 200 milliseconds.
What can be causing my application to be slow to load prior to applicationWillEnterForeground or what can I do evaluate what is happening there? Instruments does not seem to display any information about that part of the launch.
Other testing app I have don't seem the same performance. Is it the bundle size or the amount of memory used by the application? Loading dynamic libraries?
This was related to OpenAL. The app was not closing the OpenAL context and for some reason this caused considerable problems when closing and reloading the app. The app uses CosCos Denshion so I to make sure to call these.
[CDAudioManager end];
[SimpleAudioEngine end];

How to observe MPMoviePlayerController according to the playback time?

In order to invoke some events for the specified time, for example, when the video goes to 10.0s, or 20.0s , there should be some events to be invoked, is that possible to observe some property of the instance of MPMoviePlayerController for such cases ? Or any other solutions ?
I had to do almost the same thing and I didn't find any good solution except by using my own NSTimer and look at some moments the current time of the MPMoviePlayer...
So basically, every seconds I'm watching what current time it is and when I'm interrested in the time, I do my stuff.

what is the best way to update a timer UI

My app draws a timer (with detail to .1 seconds), for which I am currently using a NSTime which fires every .1 seconds. This feels like an absolutely terrible idea, but I'm not sure how else to do it. I don't really care about the .1 seconds updating always, but I would like it to update more than once per second. Is there a good way to do this?
NSTimer doesn't strike me as a bad approach. NSTimer is generally a very regular way to keep track of time (indeed it was used for animation timing before CADisplayLink came along). Unless you are seeing unacceptable performance of your timer display updating, I would stick with this approach.
If you are having issues with delays and inaccurate time readings, you could store the start time in NSDate, and continue to use the NSTimer but only to update the display. On each timer event firing, you then update the display by finding the NSTimeInterval from the start time to now. This way even if there is a performance issue, at least the time being display should remain accurate at the time of display.

Display countdown timer on simulator for a quiz type application

I am new to blackberry. I want to develop a countdown timer for a quiz type application that displays throughout the application on simulator. I am using storm version.'
how to implement it? if anybody answers i will be very thankful to them..
You can use treads to maintain the timer to force it to redraw the screen after each passing second (use sleep and invalidate functions).

Resources