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

0
votes
0answers
11 views

Timing issues on Image Slideshow (input via clipboard) [on hold]

I have been tinkering with pasting an image into a browser through extracting the data via the clipboard... I have managed to create a reasonable slideshow script working, but the problem is that the ...
2
votes
2answers
35 views

Countdown to multiple update times each day

I'm creating an update function to show my users when the next update will be available. I'm using the jQuery countdown plugin to show the time. What is a more efficient way to write this? ...
2
votes
2answers
61 views

Timer stop watch in AngularJS

I wrote a script for a timer. Is there any way to improve the code, with fewer number of lines? JSBIN ...
3
votes
1answer
62 views

Full screen countdown display

As a part of a bigger application, I wrote code which creates a display for a countdown of a given time. It is nothing fancy, but I would still appreciate a review. I am especially concerned about: ...
5
votes
2answers
110 views

Simple 3…2…1 countdown in iOS app

I would like to display a 3...2...1 countdown on my iOS app (before to take a picture) but I didn't find an elegant solution. I don't want to make a Countdown app with an NSTimer. For me the important ...
2
votes
3answers
64 views

Functions between certain times of the day

I'm working on something for my school's laptops that will disable videos/games between 8:00 AM and 3:15 PM. Due to the giant time gap, I will not be waiting to see if the code functions properly or ...
6
votes
1answer
74 views

A thread-safe stop watch utility class

I am writing a stop watch utility class in Java that I want to be thread-safe (concurrent). Here is what I have right now: ...
0
votes
1answer
64 views

Timers to use various Task(s)

I am developing a C# program, which performs various tasks in parallel threads. I created a Base task and let all tasks derived from this class execute. I just want to know if this a viable approach ...
2
votes
2answers
56 views

Timer for a Java game

I have a simple game that implements a TimerTask. However, when there's a popup using JOptionPane the timer task doesn't seem to ...
1
vote
1answer
31 views

DebugTimer design

Summary: I created this DebugTimer class so that I could test performance of code in a much cleaner/shorter syntax. Prior I was using regular timers and wrapping them all in ...
0
votes
1answer
108 views

Running a function every second

Can someone review my timer class that runs some code every second, please? The void it's calling (runCode) is just a void with ...
4
votes
2answers
126 views

Measure Method executing time - 2nd Attempt

Long time ago I've written a method that would allow me to measure the amount of time a method takes to run. I've decided to tweak this method and make use of TPL since measuring a method may take ...
3
votes
1answer
80 views

Passing arguments to a SendMail function referenced by addressOf operator

I am trying to send daily mail alert to users based on some timer values. For that I've used Addhandler to call the sendmail() ...
1
vote
0answers
41 views

A Timer Construct to Simplify Timing Blocks of Code

This is fairly simple, so I'm just looking for ideas on anything that can be cleaned up, places it can be extended, and suggestions regarding style/naming (I'm terrible at naming). It allows you to ...
1
vote
0answers
405 views

Golang concurrent HTTP request

I wanted to test the performance of concurrent http request in Go against node.js: ...
5
votes
1answer
83 views

Basic 30 TPS server loop

I've created a console server which is supposed to update 30 times per second, I'd like you to review it and also I'm curious about the accuracy of the server's loop. ...
6
votes
1answer
393 views

Beginner stopwatch app

I'm learning Swift and would appreciate any code review suggestions (the more nit-picky, the better). In particular, I'm wondering if there's a more efficient way to format the time in the ...
2
votes
1answer
40 views

Inactivity Timeout

I made this piece of code to detect inactivity on different aspects of my app. It is part of a set of pieces to analyze user behavior. Not saying it's ugly, but good looking constructive criticism to ...
4
votes
1answer
94 views

New year countdown

Here's some code I wrote quickly to get a nice millisecond countdown going. It displays the number of milliseconds until the new year in whatever timezone is next to be in 2015 are in in huge font, ...
5
votes
1answer
133 views

Random interval generator for a game

I have been working on a few games which all have a need to create "events" randomly over time. The intervals need to get shorter as time goes on if the event is negative or they need to get longer ...
7
votes
1answer
133 views

Stop Watch Application 2.0

After the tips from my previous review. I have come up with these changes: Changed my braces to start on a new line Used the Single Responsibility Principle Return early whenever possible Use a ...
3
votes
1answer
92 views

App to give cigarettes through the day

I have this app, that gives you cigarettes through the day, with equal intervals from one another. These are some important variables: wakeUp - is the time, when ...
3
votes
2answers
296 views

Stop Watch application

I've done the difficult dailyprogrammer challenge #2: Your mission is to create a stopwatch program. this program should have start, stop, and lap options, and it should write out to a file to be ...
10
votes
4answers
530 views

Multithreaded HiLo game

For my CS class I have to write a HiLo game using multithreading. I am brand new to multithreading and not sure how to best implement it. The program below works, but I am wondering if there is a ...
5
votes
2answers
2k views

Executing a task at a particular time in the morning using ScheduledExecutorService

I have a task which I need to run every 6 in the morning. I have the below code which does the job and uses ScheduledExecutorService. ...
2
votes
1answer
152 views

How to send an email every half an hour if certain condition is met during that period?

I have my below method which will be called every one minute from the background thread. In my below code, if my unauthorizedCount and ...
3
votes
1answer
91 views

JavaScript / jQuery stopwatch

Just as a learning exercise, I set out making a stopwatch without looking up how to do it etc. I know it will have been done many times before. I'm just looking for some feedback on what I should do ...
4
votes
1answer
139 views

Better method of a timer in Python

I am currently using: ...
5
votes
3answers
150 views

Finding the closest value in a collection in a game-server plugin implementation

I have an array of a instances of an enum type. A random double variable is initialized with a value between 0.... to 1, and should be used to get the closest ...
6
votes
1answer
2k views

Updating the UI with a timer - code intended to help teach

I thought it would be helpful to put together an example of what I'm talking about in the second part of my answer to this stackoverflow question. The idea is that there's some data that is updated ...
3
votes
2answers
236 views
5
votes
1answer
147 views

Pausing a SwingWorker with a Timer

I made a SwingWorker which is fetching tweets using the twitter4j API. The twitter API will allow 180 queries every 15 minutes, and then throw an exception with ...
7
votes
2answers
124 views

Exception handling for HTTP request timer

This method is used to check a URL and return the time it takes to check and the HTTP status code: ...
1
vote
2answers
1k views

Simple web alarm clock

I decided to strengthen my "vanilla JavaScript" skills since I've lately been getting more into jQuery and just discovered the potential of node.js. As a result, I decided to make a basic alarm clock ...
2
votes
1answer
62 views

Rewrote my benchmark/timer library

I created a timer library called PHPBenchTime a few years ago, and decided to rewrite it last week. This new version is meant to add in missing functionality (pause/unpause) as well as expand on the ...
13
votes
5answers
894 views

Stopwatch template

It's often useful to be able to time code, for instance, to evaluate alternative approaches to the same problem. Because this is a thing I use frequently, I have created this Stopwatch templated ...
8
votes
2answers
79 views

How can I make this userform timer faster?

I have a userform that displays a goal time for workers to shoot for when completing a task. It also has a stopwatch on it that is controlled by a start, stop, and reset button on the userform. If the ...
4
votes
1answer
142 views

Inefficient Stopwatch - revised

This is my revised code of Stopwatch: ...
5
votes
1answer
165 views

Inefficient Stopwatch

I have just finished a simple GUI stopwatch, but some of its code looks like it needs replacing. This is the code: Clock class (extends Thread): ...
3
votes
1answer
364 views

Winforms Graphical Timer Control

This is a Graphical Timer control I made for C# Winforms, which taught me quite a bit (it is my first Custom Control). The code below is a fully working application with the Graphical Timer, some ...
10
votes
3answers
1k views

Basic timer from one minute to 0

I'm a beginner in JavaScript and I am sure that there is a better way to do it (basic one minute timer from 01:00 to 00:00 running from pageload): JSFiddle ...
6
votes
1answer
486 views

Simple timer class for game model

I have a simple strategy game, and I implemented a simple counter object to count down a number whenever the game ticks. I have heard about something called NSTimer but I haven't messed with it at ...
3
votes
1answer
424 views

Schedule Global Task by using static System.Timers

I'm using System.Timers to schedule tasks. I find this working, but I'm not quite sure if it's ok to do it this way. ...
6
votes
1answer
2k views

Program to shutdown computer after a certain time

I'm trying to make a program that will shutdown my computer after a certain time that I will input via GUI. I'm wondering if I did it the correct way. Also, will this slow down my computer while it ...
4
votes
2answers
128 views

Iterate through series of timers

I wrote a short program for my exercise routine. It takes a JSON array of exercise names and duration (seconds) and puts it on the screen. The JSON looks like this: ...
4
votes
2answers
638 views

Measuring Execution Times

I was wondering which time.time() of from datetime import timedelta was the quickest and best way to find how long a programme ...
5
votes
1answer
56 views

Does this code actually give a valid representation of how quick a system is?

So I wrote this code a while ago as a way of seeing how many times it could compute a simple sum in a second (one tick). I was wondering if this gives me valid results or is in fact giving me bogus ...
7
votes
1answer
227 views

Touchless lightswitch with Raspberry Pi

I am currently developing a touchless lightswitch via a Raspberry Pi, an ultrasonic module and a nice radio module. However, I am quite a beginner in Python and it was a hard time (at least for me) ...
21
votes
9answers
2k views

Countdown Code: 'League of Legends'

I have written some code to track buffs as a side addition to the popular game League of Legends. My code is incredibly repetitive and I also have the issue of not being able to track multiple buffs, ...
10
votes
3answers
186 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 ...