timer

How to implement usermode timer in C?

How we can implement our own timer function in Windows without using Library functions? Should we deal with assembly language instructions? ...

How to implement a job that runs every hour but can also be triggered from .aspx pages?

I need a method to run every so often that does some database processing. However, I may need it to be triggerable by an admin on the site. But I don't want this method being run more than once at the same time, as this could cause issues with the way it hits the database. For example, could I... Create a singleton class that runs th...

Class in the BCL that will event at a given DateTime?

Is there an object that will event at a given DateTime or DateTimeOffset? I am using a Timer to do this operation now but it requires a bit of calculation on my part, was just thinking there might already be something in place. ...

How to change timer format

Hi everyone, Ive created timer. How can I change the timer format to second so that it wont be long number? Thanks private long startTime = System.currentTimeMillis(); Timer timer = new Timer(1000, this); timer.start(); timer.stop(); long endTime = System.currentTimeMillis(); long timeInMilliseconds = (endTime - startTime); ...

Reset timer

I have tried to reset the timer based on the current time after clicking a button, but it doesnt work. Help :-( private long startTime = System.currentTimeMillis(); Timer timer = new Timer(1000, this); timer.start(); timer.stop(); long endTime = System.currentTimeMillis(); long timeInMilliseconds = (endTime - startTime); timer.re...

How to implement a thread safe timer on linux?

As we know, doing things in signal handlers is really bad, because they run in an interrupt-like context. It's quite possible that various locks (including the malloc() heap lock!) are held when the signal handler is called. So I want to implement a thread safe timer without using signal mechanism. How can I do? Sorry, actually, I'm n...

Where has asm/timex.h and get_cycles() gone?

In an older linux distro I could call get_cycle() after including asm/timex.h. Now I changed to Kubuntu 9.04 and there is no asm/timex.h, plus in sys/timex.h there is no get_cycle(). Does anyone know why this changed, how to access this fuction/macro or a replacement for it? Or, even better, where to read information about it? Thanks in ...

timer control in vb.net

I have a timer in vb.net and it's interval is 1000ms ,. i have placed in it's timer_tick event a code that will print screen the screen and save it to a database. The problem is when i click outside of the form, or loosing the focus of the mouse to the form containing that timer/printscreen, the timer stops. As a result the printscreen ...

Synchronizing a timer to prevent overlap

I'm writing a windows service that runs a variable length activity at intervals (a database scan and update). I need this task to run frequently, but the code to handle isn't safe to run multiple times concurrently. How can I most simply set up a timer to run the task every 30 seconds while never overlapping executions? (I'm assuming Sy...

How to use safe threading for a timer(Change timer properties from different thread)

Hello, To access a memo on my form,I use the following code public string TextValue { set { if (this.Memo.InvokeRequired) { this.Invoke((MethodInvoker)delegate { this.Memo.Text += value + "\n"; }); } ...

How to access a timer from another class in C#

See Also: http://stackoverflow.com/questions/725735/how-to-enable-a-timer-from-a-different-thread-class The timer is assigned to a form and I'd like to Enable it at a specific location,but from another class.I don't want to make it public This is the code I use to access memo public string TextValue { set { ...

How to enable a timer from a different thread/class

Original post: http://stackoverflow.com/questions/725413/how-to-access-a-timer-from-another-class-in-c I tried everything. -Event -Invoke can't be done,because Timers don't have InvokeRequired property. -Public/internal property Nothing worked,the code is being executed,the timer.Enabled property is being set to "true" ,but it doesn...

Do .NET Timers Run Asynchronously?

I have a messaging aspect of my application using Jabber-net (an XMPP library.) What I would like to do, if for some reason the connection to the Server is ended, is keep trying to connect every minute or so. If I start a Timer to wait for a period of time before the next attempt, does that timer run asynchronously and the resulting Ti...

Disabling and re-enabling an asp.net Timer control using JavaScript

I have an ASP.Net web page which contains an ASP:Timer control <asp:Timer ID="TimerRefresh" runat="server" Interval="5000" Enabled="true" OnTick="TimerRefresh_Tick"> </asp:Timer> This is linked to by an asp:UpdatePanel in the page, so that a particular portion of the page is refreshed asynchronously. <asp:UpdatePanel ID="UpdatePanel1...

ShowDialog, PropertyGrid and Timer problem

I have a strange bug, please, let me know if you have any clues about the reason. I have a Timer (System.Windows.Forms.Timer) on my main form, which fires some updates, which also eventually update the main form UI. Then I have an editor, which is opened from the main form using the ShowDialog() method. On this editor I have a PropertyG...

How-to draw a circle on a changing background

There is a timer on the form and in its Tick event there is this line of code: this.BackColor = ColorTranslator.FromHtml("#" + ColorCodesBack[_index]); CurrentColor = ColorTranslator.FromHtml("#" + ColorCodesFore[_index]); SolidBrush sb = new SolidBrush(CurrentColor); g.FillEllipse(sb, this.Width/2 -200...

Proper way to pause a System.Timers.Timer?

I'm looking at how to pause a System.Timers.Timer and I cannot figure out the proper way to pause it without resetting the timer. How to pause it? ...

How can I use a timer in my console application?

How can I use a timer in my console application? I want my console application to work in the background and to do something every 10 minutes, for example. How can I do this? Thanks ...

How do I do timers in Java?

I'm implementing the x-modem protocol in Java. If there is a timeout while I'm receiving a packet then I have to send negative acknowledgment. I have to start a timer, and when the time is up then I send a message to the sender requesting file transfer from the begining. But I'm not getting how to do timers in Java; may I see some sampl...

Call repaint from another class in java?

Hi all. I'm probably doing this wrong, so please be nice. I'm developing a java game, and I'm at the stage of testing character movement / animation. The "person" can move up down left and right on a grid. The class the grid is drawn in the gamePanel class. The buttons are in the gameControlPanel class. I have a button which spawns a p...