Questions tagged [timer]

Timer is a component that has the functionality to trigger a user defined action at regular intervals as configured by the user.

Timer is a component that has the functionality to trigger a user defined action at regular intervals as configured by the user.

Some timers (such as Java Swing timer, WPF DispatcherTimer, WinForms Timer) are also capable of firing they events in GUI thread so there is no need to switch into this thread in order to update the components. Other timers do not have this capability and are more optimized to handle big number of scheduled events.

Depending on how does the scheduler behaves if the new even should be fired when the current event has not yet been fully processed, the timer may be coalescing or non coalescing. A coalescing timer reduces multiple pending events to a single event, reducing the number of events to handle. A non-coalescing timer fires pending overtime events in rapid succession with no delay between them, in order to catch up.

19566 questions
4
votes
6 answers

How would I go about implementing a stopwatch with different speeds?

Ideally I would like to have something similar to the Stopwatch class but with an extra property called Speed which would determine how quickly the timer changes minutes. I am not quite sure how I would go about implementing this. Edit Since people…
James
  • 80,725
  • 18
  • 167
  • 237
4
votes
2 answers

Need A Timer To Fire At Specific Time And Every 5 Minutes Until Job Complete

I need help setting up a specific type of timer for my application. My scenario is this: I want to run a timer at a specific time of day (say 4:00AM). That timer then executes a number of different events that each go off and grab data from a…
Riples
  • 1,167
  • 2
  • 21
  • 54
4
votes
1 answer

Use CountDown Timer or roll my own based on Handler in Android

This post: http://android-developers.blogspot.co.uk/2007/11/stitch-in-time.html describes how to implement a timer using a Handler. I could achieve the same thing using a CountDown…
user1977132
  • 487
  • 2
  • 18
4
votes
3 answers

iOS: How to get a Timer app to play custom sounds when the APP is in background?

General problem / application background / purpose: I have a Timer app and I would like to play a custom sound when the App is in BACKGROUND state and receives a UILocalNotification. I utilize UILocalNotification to trigger the timer (its the only…
mm24
  • 9,280
  • 12
  • 75
  • 170
4
votes
1 answer

How to pause the timer in c#?

I have a timer in my code with a 10s interval. When the time elapses I will do some checking. It may takes more than 10s for checking and some update jobs. However, if I didn't stop the timer, it seems the checking will execute every 10s. If I call…
Jay
  • 529
  • 1
  • 11
  • 21
4
votes
3 answers

Android CountDownTimer Class Lagging Main Thread

I am trying to use android.os.CountDownTimer to literally show a countdown timer via a textview for fitness purposes. The issue I am having is the timer seems to be having trouble running on the main thread i.e. the countdown will jump 2-4 secs and…
Tyler Thomas
  • 173
  • 1
  • 13
4
votes
4 answers

extra argument userinfo in call

Get the compile error message from xCode with Swift language: "extra argument userinfo in call". the question is how to use userInfo data from timer to argument "userInfo" in notification center. func…
lotosn
  • 51
  • 4
4
votes
4 answers

C++ : How do I execute a function after several seconds?

Firstly, I'm using VS2008 (doesn't support C++11). I can't upgrade and need to use native libraries only because it needs to be compiled on another persons' compiler which I don't have control over. I would like to run the code automatically after 5…
John Evans Solachuk
  • 1,953
  • 5
  • 31
  • 67
4
votes
2 answers

Time running backwards with QueryPerformanceCounter()

I have found useful information regarding the use of QueryPerformanceCounter in this post but I am facing an issue for which I have not found an answer. I am developing an application for Windows CE 6.0 and need a better resolution that…
ISZ
  • 43
  • 4
4
votes
2 answers

How to change label content with timers throwing InvalidOperationException

I'm making an application and I'm using a timer in that application to change label content in WPF C# .NET. In the timer's elapsed event I'm writing the following code lblTimer.Content = "hello"; but its throwing an InvalidOperationException and…
necixy
  • 4,964
  • 5
  • 38
  • 54
4
votes
5 answers

How can I make this timer run forever?

from threading import Timer def hello(): print "hello, world" t = Timer(30.0, hello) t.start() This code only fires the timer once. How can I make the timer run forever? Thanks, updated this is right : import time,sys def hello(): while…
zjm1126
  • 63,397
  • 81
  • 173
  • 221
4
votes
2 answers

Designing a traffic light application

My teacher asked us to design a traffic light application. The application will have three button: start: to start the traffic light. When we press the button we see red circle, 2 seconds after we see green circle, 3 seconds after we see orange…
Hunsu
  • 3,281
  • 7
  • 29
  • 64
4
votes
3 answers

Global Timer in Javascript with Multiple Callbacks

I want to create a global timer object in javascript and then be able to add callbacks to it on the fly. This way I can just use one global timer in my script to execute all actions at a certain interval rather than wasting resources by using…
Mike Beepo
  • 79
  • 2
  • 5
4
votes
2 answers

How does libuv and Node.js actually schedule timers?

How does libuv and the operating system actually schedule timers like setTimeout and setInterval in Node.js? I see that no CPU is used by the node process until a timer fires. Does this mean the OS schedules the timer, and wakes up the Node process…
gx0r
  • 4,682
  • 2
  • 23
  • 24
4
votes
2 answers

AVR Timer Programming : CTC mode vs. Normal mode

When comparing the advantages and disadvantages of CTC mode and Normal mode in AVR Timer programming, which one do you think is better? Why? Can you explain more for me? Thank you for you help.
Casper
  • 4,435
  • 10
  • 41
  • 72