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
3 answers

Question About Timers And Variable Intervals

The point of this timer is to execute some code whenever it's midnight. So basically, the first interval will be between Now and midnight and all intervals following that will be 24hours. Now that's all well and good, but I was wondering how this…
sooprise
  • 22,657
  • 67
  • 188
  • 276
4
votes
4 answers

The best way to refresh my .aspx site with a Timer in C#?

I have a default.aspx page that needs to be refresh every 10 sec. My solution so far is a javascript function, but it only works in Firefox and not IE. I'm looking for a way to handle the refresh mecanism in the default.aspx.cs page instead, with …
radbyx
  • 9,352
  • 21
  • 84
  • 127
4
votes
3 answers

How to prevent Timer Elapsed event from occurring if forms application closes C#

I have a timer in a windows forms application (Visual C#) that is causing problems when I want to exit the application. The timer is defined as a member of the form's class: partial class Form1 { //These are the members in question: …
JoseOrtiz3
  • 1,785
  • 17
  • 28
4
votes
2 answers

Pausing timer without destroy and re-create - Android

I have this AsyncTask, that sleeps 0.1 second each time that executes "doInBackground", before that I was using a CountDownTimer to control my time. My problem is: I want to achieve a timer that can Pause without calling .cancel() and when starts…
guisantogui
  • 4,017
  • 9
  • 49
  • 93
4
votes
2 answers

Xcode Swift Stopwatch App

I have a stopwatch app I'm making that currently shows the minutes, seconds and milliseconds on a UILabel. It has a 'Start' button and a 'Stop' button. The code is below. How do I add hours to it? Also how do I make it continue where it was, when…
ChallengerGuy
  • 2,385
  • 6
  • 27
  • 43
4
votes
2 answers

Making this timer start with a button

I found this neat countdown timer and I was curious if someone could help with a few changes to it. Start on the click of a button. Where would I place an AJAX call function to a PHP file for when the timer hits 0? Repeat when it is…
4
votes
2 answers

System.Timers.Timer steadily increasing the interval

I am currently working on a time sensitive program, where is is important that i do a reading from a device every second. I am currently using a Timer for this, i have however found that the time steady increases the interval with 1 ms pr tick. This…
Androme
  • 2,399
  • 4
  • 43
  • 82
4
votes
1 answer

sending signal from subcomponent in elm

I'm making a small application in Elm. It displays a timer on the screen, and when the timer reaches zero, it plays a sound. I'm having trouble figuring out how to send a message(?) from the the timer to the sound-player. Architecturally, I have…
illabout
  • 3,517
  • 1
  • 18
  • 39
4
votes
1 answer

Is there a way to find the running timers in java?

Is there a method to find out how many timers are running in Java? Something like an ActivityManager for Activities in Android ? I noticed that timers can be created with a given name. How can I refer to a timer by it's name? public Timer (String…
Newbie
  • 161
  • 5
4
votes
2 answers

Google Forms Timer

I am looking to create a timer on a quiz that I am creating in Google Forms. I have found this post here - How to add a timer to Google Forms for a School Quiz? - from 2013 where it's mentioned that scripting might make this possible eventually. I…
5k313t0r
  • 51
  • 1
  • 1
  • 8
4
votes
1 answer

Catching exception thrown by threading.Timer in a context manager

I have written a simple TimeManager: a context manager that fires of a threading.Timer when the context is entered and cancels it when it is exited. If the timer goes off before exiting the context, it raises an exception: import threading class…
Jir
  • 2,985
  • 8
  • 44
  • 66
4
votes
1 answer

Atomically cancel asio asynchronious timer from another thread

I have a boost deadline_timer which runs periodically (as in example http://www.boost.org/doc/libs/1_35_0/doc/html/boost_asio/tutorial/tuttimer3/src.html): #include #include #include #include…
andigor
  • 722
  • 6
  • 17
4
votes
2 answers

Memory leak with Timer

I am using a timer that is canceled and restarted on a listener event. It all works fine except that the the timer thread leaks the whole outer class. My timer implementation is as follows: if(timer != null) { timer.cancel(); …
marcel12345689
  • 243
  • 1
  • 3
  • 8
4
votes
2 answers

Need a Java based interruptible timer thread

I have a Main Program which is running a script on the target device(smart phone) and in a while loop waiting for stdout messages. However in this particular case, some of the heartbeat messages on the stdout could be spaced almost 45secs to a…
LambeauLeap
  • 285
  • 2
  • 4
  • 11
4
votes
4 answers

Are timers supported by the Windows native API?

Does the Windows native API support timers? I am aware that POSIX implementations on Windows support timers, but I am interested in Windows SDK APIs.
Jay
  • 24,173
  • 25
  • 93
  • 141