This tag is for questions about using timers in code to make things happen in a certain order or for gathering amount of time elapsed.

learn more… | top users | synonyms

3
votes
0answers
24 views

Is this timer efficient?

I found myself writing code to run at a specified frequency more than once, so I decided to make this simple timer. My main concern is that this is not the most efficient way of doing this since with ...
0
votes
0answers
35 views

Learning using Neural Network

This is my code for MLP backpropagation. ...
6
votes
1answer
69 views

Timer utilizing std::future

I have a Timer class executing a function in a specified interval: ...
3
votes
1answer
44 views

Utility object for setTimeout

I was using setTimeouts for a project where a callback will be called after a duration, but the user has the options of extending, pausing or stopping the timeout. I felt using the default setTimeout ...
2
votes
1answer
38 views

Auto change page title while bookmarking a page

Here is what I'm trying: Please review the code: ...
4
votes
1answer
79 views

Simple Multithread Timer

This is a very basic timer that can support multithreading with std::thread and std::chrono. The timer has the classic ...
4
votes
2answers
239 views

Portable periodic/one-shot timer implementation

I have implemented a class that provides portable one-shot or periodic timers. The API provides a way to schedule one or more timer callbacks to fire some number of milliseconds in the future, and ...
6
votes
2answers
167 views

Java GUI code with Swing Timer

I have the following questions for the below code: Is there a simpler implementation of an on-screen counter? I made CountTimer inner class since it's tightly ...
1
vote
1answer
83 views

Executing method on a certain interval + offset

I would like to execute a certain method at a given interval. The reason why I can't use a timer + its event handler right away is because I want to add an offset to each tick (100ms in my example ...
5
votes
1answer
116 views

Listening for values changed by the memory

I'm fetching some values from the memory. I would like to create some custom events that I can listen to for each value. Since there are no existing events regarding memory changes, I've decided to go ...
0
votes
2answers
2k views

Time of day based timer - run function at certain time, daily

I need to call a function exactly at certain hour, daily, my programs runs 24/7. I wrote the following timer mechanism, which generally works that way: Calculate time until hour and generate timer ...
4
votes
1answer
204 views

Is this kitchen timer code pythonic?

I've been doing bits and bobs with Python for a few years, but I've never took the time to get feedback on what's pythonic and what's not. In the interest of collaborating more with Python ...
2
votes
2answers
217 views

Timer factory fn optimization

I use this Timer function quite a bit lately for all sorts of stuff, and would appreciate if someone could review/analize/criticize/verify and, of course, suggest things I can do to optimize it for ...
1
vote
1answer
258 views

Rewriting timers in .NET with lambda

...
2
votes
1answer
130 views

Opinions/Improvements on a run periodically/timer function in Python 2.7

I'm looking for some opinions on this bit of code that I wrote and if there are any ways it can be improved. The scripts aim is to run the function runme() every 60 seconds with a random interval ...
6
votes
1answer
738 views

How to make this ping test with timer more efficient?

I wrote a small ducktaped VBA script which pings servers every 15 mins or so. If a server's status is anything other than "Alive", the server and timestamp is written to another worksheet called ...
2
votes
1answer
873 views

Java - Is this the correct implementation of a timer/timertask to destroy a process that overruns a defined time limit

I was wondering if this is the correct implementation of a times task to destroy a thread after it overruns a predefined time period: it works by creating a getting the thread from ...
-1
votes
1answer
531 views

arduino timer to print array of serial data at specific intervals, syntax problem [closed]

I was wondering if you guys could help me solve an arduino Coding problem. I've simplified the code to highlight the issue that I'm having. I've created a program to read streaming serial data to an ...
4
votes
2answers
2k views

Timer Tick Event only to execute at specific time

I have a timer that is only supposed to tick between x and x on weekdays. I have used the following implementation. ...
4
votes
1answer
1k views

The correct (and safe) way to use a Timer to poll a Delegate

This is a followup to Polling loop to run in a background thread where I was initially using a single thread and Thread.Sleep() to poll a delegate. I was ...
1
vote
1answer
117 views

Timed series of events. Logic for organizing events based on time? [closed]

I would like to execute a series of events at the time at which they occur. The events are stored in a list and always sorted by time of execution. ...
1
vote
1answer
504 views

Timer implementation

I have a Visual Studio 2008 C++03 project where I need a timer. I have an implementation that works well, but I'd like any general suggestions from the community on how to improve it. (More generic, ...
1
vote
1answer
269 views

Timer wrapper review

I used this code in several projects. But I am not sure if it is stable. However on production it is working well, but I want to listen your advices: ...
2
votes
3answers
3k views

Timer class for games

I've tried to write a simple timer class that could later be used in games, such as for updating the screen every second. Problem is, I read gettimeofday() was ...
5
votes
4answers
3k views

Linux C++ Timer Class: How can I improve the accuracy?

I wrote this class today, but I am trying to figure out how to make it more accurate. I pass in seconds and multiply by 1000 to make it milliseconds, and the time does not line up. I need the ability ...
5
votes
1answer
160 views

qos method call using DateTime and Stopwatch

I need to limit method call to 80 times per second (for each connectionId). My initial version: ...
5
votes
2answers
446 views

Homemade Stopwatch class

Here's some explanation for accuracy and neg_accuracy: It's meant to keep all the values in terms of what the user specified he ...