timer

ScheduledExecutorService.scheduleAtFixedRate And Setting initialDelay To Date In The Past

I'm working on a scheduling system in Java that sends out reminders based on a startDate, endDate and occurrence (hourly, daily, weekly, monthly, Mondays, etc). Originally I was using Timer and TimerTask classes to schedule the reminders: Timer timer = new Timer(); timer.scheduleAtFixedRate(reminder, firstDate, period); I recently swi...

Timer.Interval Question

I want to trigger KillZombies every night at midnight. The problem I'm having is that the first timer interval is retained and not reset to 86400000 milliseconds as I'm trying to do in my method. Is there any way to remove the old interval and replace it with a new one? System.Timers.Timer Timer = new System.Timers.Timer(); Timer.Ela...

Monotonic WaitableTimer in C#

Is there a Monotonic WaitableTimer available in C#, or even in Win32 that I could wrap? Currently I'm using the Win32 CreateWaitableTimer, but if the system clock gets modified it will skew the timer values and cause things to happen before or after they are scheduled to occur. The only Monotonic clock source I've found available in ...

Does a thread safe timer exist?

Is there another equivalent of Timer for android which is thread safe? Using the timer causes problems in my application while updating the gui, most of the time it complains that gui is being updated from another thread, i tried using handlers but that didn't fix the problem. ...

How to use clock() in C++

How do I call clock() in C++? For example, I want to test how much time a linear search takes to find a given element in an array. ...

Changing Android system clock stops timers. How can I restart them?

Hello, I need to run a periodic task in an Android application. I currently use a timer like this: final Handler guiHandler = new Handler(); // the task to run final Runnable myRunnable = new Runnable() { @Override public void run() { doMyStuff(); } }; Timer timer = new Timer(); timer.schedule(new TimerTask() { ...

Scheduling a single-fire event.

I'm writing an application which requires a status bar update for while a database is being loaded. I set the label to "Database loading..." then load the database with a BackgroundWorker. When the worker completes, I set the label to "Database loaded." This is only done on startup, however, and I don't want the label to be visible for m...

Timer Job Scheduling on DataSheet Entry in SharePoint

I have a list on which I have an ItemUpdated handler. When I edit using the datasheet view and modify every item, the ItemUpdated event will obviously run for every single item. In my ItemUpdated event, I want it to check if there is a Timer Job scheduled to run. If there is, then extend the SPOneTimeSchedule schedule of this job to ...

Timer that supports overlapped I/O (for IOCP) ?

Hello, I need to add timers support in an application based on I/O Completion Ports (IOCP). I would like to avoid the use of a specific thread to manage timers. On Linux, you can create a timer that delivers expiration notifications via a file descriptor (see timerfd.h man), so it's great to use it for example with epoll if your applic...

How to pause execution yet keep webbrowser control loading in C#.

I'm trying to make a web browser that tells me when a specific video is done. I already know how to get the time in seconds of how long it takes. I just need to know how to wait to execute the next step without stopping the webbrowser control (which needs to play the flash video). Any ideas? I've been looking into the Timer class, but c...

Enter on frame or timer - which to better use for updating in AS3?

So I've about hundred of map tiles and each title has some object which does some stuff. And one of things it should do is to update text (a time after which you need to do something) in text field. How should i do it better - with enter frame event and on each enter frame update it or set up a timer object which on each second would upd...

what is a more elegant way of toggling a javascript timer

I made and use this one, but I know theres better ways : function toggle_timer() { if(timer_id > 0){ clearTimeout(timer_id); timer_id=0; } else timer_id = setInterval("go()", interv); } Its based on the assumption that youll only use 1 timer (otherwise, who knows which timer youll clear?) So far this has...

Silverlight 4 Equivalent to .NET Timer Control

Basically I'm wanting to insert a dynamic clock in my project. Right now I'm using the dateTime control which is fine but it's static. I need the clock to change digits with each second. In c# there is a Timer control that I would be able to use to make this dynamic clock possible. However, in Silverlight 4 I have not been able to lo...

Performing an action in Rails at a specific time

Guys, Is there a way to setup a callback in ROR that would trigger at a specific time? Lets say I'm running a contest that expries at a certain time. Lets say Monday July 28th at 9:00. I'd like to set up an observer that ran a function at Monday July 28th at 9:00. Does rails have a method to do this? ...

swing: UI for a countdown timer

I need a variable countdown timer for between 1-10 seconds, that can be stopped and restarted. What's a good set of UI elements to use for this? I need something intuitive that uses a fairly small amount of screen real estate, comparable to a normal-sized JButton. A windup kitchen egg timer would be the best physical analogy: NOTE: I ...

How to use the same function for both a Timer event and Mouse event in AS3?

Hi everyone, so today my question is how can we have 1 function triggered by both a Timer event and a Mouse event? 'm trying to avoid having to re-write/re-name a function just because I also have a Mouse event that triggers it and not just a Timer event. Issue: I have a addThis bubble fade in with icons on a button rollover, the addTh...

C# Windows Service - Multiple timers

I'm developing a windows service that will need to do multiple tasks at different periods. I currently have two timers, a full timer and a stock timer running at different intervals defined like below. fullTimer = new System.Timers.Timer(); fullTimer.Elapsed += new ElapsedEventHandler(OnElapsedTime); fullTimer.Interval = Convert.ToD...

how to stop a timer triggered runloop ?

if i set up a runloop like that: NSRunloop* loop = [NSRunloop currentRunLoop]; [runLoop addTimer:anyTimer forMode:NSDefaultRunLoopMode]; can i stop it again ? or is the only way to ignore the notification i use to trigger the further action ? ok, i give an example for the problem: -(void)blinkeffekt:(double)pollingTime{ NSRunLoop* ...

Android: Auto Refresh Google Maps

Hi all, I want to ask about how to auto refresh the Google Maps? So i have an activity with radio button inside that user can choose about the interval of the auto refresh. Then I create a class with a map view with class that extends the CountDownTimer. The problem is MyCountDownTimer has a constructor that display it own interface. H...

Python Threading with Timer

I would like 3 Threads in Python to run for n seconds. I want to start them all at the same time and have them finish at the same time (within milliseconds). How do I do this? threading.Timer only starts after the previous one has been completed. ...