How to find out if a Timer is running?
If I have an instance of a System.Timers.Timer that has a long interval - say 1 minute, how can I find out if it is started without waiting for the Tick? ...
If I have an instance of a System.Timers.Timer that has a long interval - say 1 minute, how can I find out if it is started without waiting for the Tick? ...
I'm just trying to time a piece of code. The pseudocode looks like: start = get_ticks() do_long_code() print "It took " + (get_ticks() - start) + " seconds." How does this look in Python? More specifically, how do I get the number of ticks since midnight (or however Python organizes that timing)? ...
I've been building an error logging app recently and was after a way of accurately timestamping the incoming data. When I say accurately I mean each timestamp should be accurate relative to each other (no need to sync to an atomic clock or anything like that). I've been using datetime.now() as a first stab, but this isn't perfect: >>> ...
I'd like to do some basic profiling of my code, but found that the DateTime.Now in C# only have a resolution of about 16 ms. There must be better time keeping constructs that I haven't yet found. ...
I want to use a timer in my simple .Net application written in C#. The only one I can find is the Windows.Forms.Timer class. I don't want to reference this namespace just for my console app. Is there a C# Timer (or Timer like) class for use in Console apps? ...
Just this - How do you add a timer to a C# console application? It would be great if you could supply some example coding. ...
Which is the best timer approach for a C# console batch application that has to process as follows: Connect to datasources process batch until timeout occurs or processing complete. "Do something with datasources" stop console app gracefully. related question: http://stackoverflow.com/questions/186084/how-do-you-add-a-timer-to-a-c-co...
I have a legacy WinForms Mdi App in VB.Net 2.0 which I am adding functionality to. One of the additions is a warning which needs to be raised when the current time nears a specified value (a deadline). My intention is to check the time once an hour until there is less than an hour until the deadline, then display warnings at specified in...
Something that has always bugged me is how unpredictable the setTimeout() method in Javascript is. In my experience, the timer is horribly inaccurate in a lot of situations. By inaccurate, I mean the actual delay time seems to vary by 250-500ms more or less. Although this isn't a huge amount of time, when using it to hide/show UI elemen...
So I made some timers for a quiz. The thing is, I just realized when I put javascript: alert("blah"); in the address, the popup alert box pauses my timer. Which is very unwanted in a quiz. I don't think there is any way to stop this behaviour... but I'll ask anyway. If there is not, mind suggesting what should I do? ...
Does Linux/Unix/Posix provide an API to user-space applications to access a monotonically increasing clock, with centisecond to millisecond accuracy? On Linux, /proc/uptime provides a string-based representation of a floating point number of the number of seconds the system has been up. gettimeofday(2) does not provide a monotonically ...
This question is inspired by Does Linux provide a monotonically increasing clock to applications. Maybe I should be more precise: I'm looking for a clock function which is strictly increasing, thus never returning the same value, independant how quick two calls follow each other. ...
I am using a microcontroller with a C51 core. I have a fairly timeconsuming and large subroutine that needs to be called every 500ms. An RTOS is not being used. The way I am doing it right now is that I have an existing Timer interrupt of 10 ms. I set a flag after every 50 interrupts that is checked for being true in the main program l...
Hi, I am trying to use timerfd_create and timerfd_settime under Debian Linux lenny. The manpage says to include <sys/timerfd.h>. This file cannot be located on my System. According to the Debian Package Search the only packages with a timerfd.h are the linux-headers-* packets. I have installed the packets linux-headers-2.6.26-1-amd64 ...
What's a simple/easy way to access the system clock using Java, so that I can calculate the elapsed time of an event? ...
For some odd reason the Elapsed event is firing twice, where it should definitely be firing once. And immediately after, the timer ceases to work... The code structure is somewhat like this: A certain object is defined to fire a certain event when a value it contains, which is constantly updated in 500-1500ms intervals, increases in over...
Hi, I need a timer tick with 1ms resolution under linux. It is used to increment a timer value that in turn is used to see if various Events should be triggered. The POSIX timerfd_create is not an option because of the glibc requirement. I tried timer_create and timer_settimer, but the best I get from them is a 10ms resolution, smaller ...
Given a System.Timers.Timer, is there a way from the main thread to tell if the worker thread running the elapsed event code is still running? In other words, how can one make sure the code running in the worker thread is not currently running before stopping the timer or the main app/service thread the timer is running in? Is this a m...
Hi all, I've implemented a tap-and-hold handler using an NSTimer that I first set in the TouchesBegan overload. However, what I actually want is for an action to be continuously performed in quick-fire succession while the touch is being held. So, on timer expiry I call a handler to do the work, which then sets another timer and the cy...
Today I had my first test with the ASP.NET AJAX Timer Control, in hope that it would allow me to constantly keep updating my site. At the moment, it just updates once; this does not match the behavior of the previous .NET timers. Was the AJAX Timer control only made to update an item once? Or do I need to use another framework? ...