timer

clock_gettime and clock resolution

I'm using the POSIX function clock_gettime on the monotonic clock and the times that I'm getting back aren't multiples of the result of calling clock_getres on the monotonic clock. For example, the resolution is being reported as 0s 999848ns and I have gettime result of 29198s 65414236ns (time divided by resolution gives 29,202,504.19...

question about System.Windows.Forms.Timer

Hi All I am building a WinForms application reading from a socket data and charting lines. I am using System.Windows.Forms.Timer to trigger each second the event that gets data from a queue filled by a socket redraws lines on the chart My Question is about the Timer object: I have one Timer object for each WinForm having a chart to ...

Should I use Ajax Timer?

I want to have a stopwatch on the site, which displays running time on the label without reloading a page. Is it possible to do this on client side? Should I use Ajax timer or smth else from .net? Website is in C#. Some links or demos would be really helpful ! Thanks ! ...

Excel VBA Application.OnTime. I think its a bad idea to use this... thoughts either way?

I have a number of users I support that are asking for things to happen automatically ( well more automagically but that's another point!). One want events to happen every 120 secs ( see my other question ) and also another wants 1 thing to happen say at 5pm each business day. This has to be on the Excel sheet so therefore VBA as addin...

keydown freezes timer c#

Hey, I am making a frogger type game and I am using a timer to make the images move across the screen. I am also using the keydown event to handle when the user moves the 'frog'. So, w moved up, s moves down etc. The problem I have come across is that whenever the user presses any movement button, the timer freezes. This means if the us...

jQuery resume setInterval timer on keystroke

I have a jQuery setInterval function named "timerIncrement" that times out (stops incrementing the variable [licount]) after x-seconds. to resume this interval I have a .mousemove function which looks like this: $(this).mousemove(function(){ licount = 0; timerIncrement(); }); what I'm looking for is a way to do this exact thing (res...

How to find the time taken to send data across UDP

I have a simple UDP client server written in C++ on Ubuntu 9.10 where the client sends a set to the server. How can I check how much time s it taking to sent it. I need to find the time from start of transfer to end. Supposing my server and client are on the same machine then can I somehow save the system time and find the difference or...

JS 2 minute countdown then execute a function?

I'm not that great at Javascript, for the record! I DO know how to use ajax. I just need a bit of help. I'm having a hard time figuring out how to display a 5 minute countdown, and once the countdown hits zero, to run a function. I need to pass a variable to the function that needs to run. I tried SetInterval but this isn't exactly my ...

SetTimer dependent on WS_EX_COMPOSITED?

Strange one here: I've got a window created with an extended style of WS_EX_OVERLAPPEDWINDOW | WS_EX_COMPOSITED. On WM_SIZE I create (or reset) a timer using SetTimer, which calls a draw function after a 100 ms pause in resizing (Helps smooth resize.) That's working just fine, but I just noticed that if I remove the WS_EX_COMPOSITIED s...

Timer get interval time

Hi, I created a Timer private static AutoResetEvent autoEvent; private static Timer stateTimer; public static void Start() { autoEvent = new AutoResetEvent(false); TimerCallback timerDelegate = new TimerCallback(SomeClass.TimerLoad); stateTimer = new Timer(timerDelegate, autoEvent, 1000, 3 * 60 * 60 * 1000); } from other ...

Unit test System.Threading.Timer in .NET

How to unit test a timer based on System.Threading.Timer in .NET The System.Threading.Timer has a callback method ...

Change property based on timer in Silverlight

Assume I have a class that looks like this: class Sample { public string Value { get; set; } public DateTime Begin { get; set; } public DateTime End { get; set; } } I want to display a list of Sample instances where each one changes color when the current time passes Begin and then changes color again when the current time...

C# Convoyor-Belt-like buffer - Time constrained buffer

Hello, I'd like to program a buffer that is time constrained. It means that I want to be able to continuously fill up a List of string (for instance) and every 2 secondes that list is added to another list (or send to the network) whether this list has 1 or more elements, but another List of string take its place so that there are alway...

Thread Vs javax.swing.Timer, controlling game animation in Java?

Hi, I have this very straight forward question regarding Thread and Timer classes in Java as a way of creating game animations. Which is better of the two? What are really the differences between the two and which is the most preferred in terms of animation in Java? I hope my question makes since, this is in someway related to the answer...

Is System.Threading.Timer efficient enough for thousands of concurrent timers?

I'm working on a request timeout mecanism. My initial approach would be to create one System.Threading.Timer for each request. The number of concurrent requests could scale up to thousands. I'm wondering if I should instead create a TimeoutScheduler that would internally use only one timer instead of having one per request. Can anyone ...

is there a system event I can hook into for time updates with .NET?

I'm building an application that needs to fire an event every second, but it needs to be at the top of every second. Firing between seconds is not good enough. I don't think a timer will be acceptable since, while I can set it to fire every second, I can not tell it to start at the top of the second. And it will probably drift slightly o...

Execute periodic tasks using a timer with a different interval as intended

Hi, I am forced to execute a periodic task using a timer that is invoked at a different interval as the period I'd like to execute this task. Note that the timeout does not occur 100% accurately; i.e. timeout(javax.ejb.Timer timer) in the code below might be invoked at intervals 100, 98, 105ms etc. So, I came up with this, which is ...

Timer does not stop in android

I made an application in android and used timer like this.. try { CountDownTimer start1 = new CountDownTimer(20000, 1000) { public void onTick(long millisUntilFinished) { TextView timeShow = (TextView)findViewById(R.id.showTime); timeShow.setText(" "+" 00:" +millisUntilFinished / 1000); ...

Android architecture for real-time applications

I'm having some trouble achieving adequate real-time performance from my application and am wondering if I've architected it suboptimally. The requirement is for the application to play a sound and draw a line on a Canvas at a user specified time interval. I have a Thread that sleeps for the user-specified time interval, wakes up and u...

NSTimer crashes iphone simulator on second run

Beginner programmer. Working on a timer app. The following applicationWillTerminate saves the state of started, stopped, startTime and stopTime and invalidates the timer. The intent is to be able to terminate application then restore state and restart timer on app restart. //Save status to file on applicationWillTerminate. - (void)ap...