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

1
vote
1answer
28 views

Custom countdown timer class to replace the Android CountdownTimer

This project was made to replace the stock Android CountdownTimer class. It is more responsive when completing the timer and adds additional functionality such as ...
3
votes
2answers
301 views

Android splash screen

I have implemented a splash screen, to hold/pause the screen for few seconds and then launch the next screen. I am very enthusiastic to know if there is a more basic way to write the code. ...
1
vote
0answers
21 views

Pomodoro clock in js

I created a JavaScript library on Pomodoro time management method. I don't know if it's good so I though that you can help me with reviews. ...
5
votes
1answer
60 views

CountDownTimer that responds to clicks

The app: Creates CountDownTimers and displays them in a simple layout. The user can choose how long the timer should be through SharedPreferences and a settings activity. Each timer has a preparation ...
1
vote
0answers
64 views

Portable periodic/one-shot timer thread - follow-up

This is a much improved version (I hope) of code in this previous code review of mine. I have: renamed several things. Are the names good? made it lazily start the worker thread only after the ...
3
votes
1answer
36 views

Sleep with count down display

I have a sleep function which displays the time remaining in sec, some feedback would be appreciated ...
2
votes
1answer
15 views

JavaScript idle managing structure

I am just getting into the world of javascript, coming from the world of classical inheritance. The following is a library I wrote to track when a webapp is idling and I wrote it like I write ...
1
vote
1answer
56 views

A small timer in C

I needed to make a timer to profile small programs a while back. My use wasn't for a major project or mission critical code or anything even remotely close to that, just for personal learning ...
5
votes
2answers
83 views

StopWatch app in android

Activity ...
3
votes
1answer
143 views

Detecting the duration of a button press in a microcontroller project

I'm a C++ newbie and so far have written my code mostly in an not OO way. Since this is getting confusing I'd like to start creating libraries for some of the functionalities that I've implemented. ...
2
votes
1answer
41 views

XCTestCase#waitFalseExpectationUntilTimeout implementation

I am working on an iOS project and I'm in charge of testing most parts of it. As I write some tests, I often have the need to wait for an asynchronous method to finish, and then test that something ...
3
votes
0answers
73 views

Basic game engine: timer, FPS and logic loop

I'm creating a simple Java game engine (just for fun). The idea is to create a basic framework for developing any kind of 2D game, an abstract engine that does the hard work. Would you like to review ...
1
vote
0answers
44 views

Update method using timer in WinForms Poker app

I have a WinForms Poker app that needs to update some stuff and im doing this by using a timer: ...
3
votes
1answer
47 views

Simple load testing script in bash

Here's the code ...
4
votes
3answers
161 views

A reusable AJAX polling function

I have written a small JavaScript function which performs an AJAX request every x seconds. I was hoping some of you could give it a look over and give me any pointers on redundant code or bad ...
3
votes
1answer
70 views

Script to pick random answers for a vocabulary quiz

I am making a small script, which, when run in the console on Vocabulary.com, picks one answer (the third or fourth) and clicks. Then the code checks if the answer was wrong or right and goes to the ...
7
votes
1answer
115 views

Chess countdown timer for Arduino LCD Keypad

I'm very new to C++ and Arduino, with a background in Python. I've written this code for a countdown timer and a simple menu to set the time available to each player, using button handling code from ...
4
votes
2answers
142 views

Event timers database interaction layer

I've just started with the basics of OOP. At first it looked complicated, but once I just started with it, it seemed so easy and everything seems to work like a charm, and that's why I'm unsure if I'm ...
1
vote
2answers
60 views

Lower the volume of my computer over time in Python

I wrote a program to gradually lower the volume of my computer when I go to sleep so I can fall asleep with TV or music on. This was my first time using argparse and I feel like there should be a ...
2
votes
1answer
107 views

Custom countdown second timer

I'm making a card game and I found useful to include a 60 second countdown timer. Here is my approach: ...
1
vote
0answers
53 views

Restarting properly

I have an activity with a timer in it, which starts an activity when the timer goes down. Before, when onPause() would get called after a phone call, my activity ...
1
vote
0answers
66 views

Millisecond timer using plain standard C++98

For development I'm using timer classes that are based on Win32 functions like QueryPerformanceCounter() or the time stamp counter of Intel-compatible CPUs. ...
3
votes
2answers
122 views

setTimeout and setInterval

Problem statement After 10 sec of execution of a program, start reading the property descriptors of each property of an object and continue reading all remaining properties each, every 3 ...
5
votes
1answer
218 views

Minimalist countdown timer with C#

I'm looking to add a module to one of my utility classes that functions as a countdown timer for tools that execute tasks after a certain amount of time. The code below is what I have working for PoC, ...
3
votes
0answers
30 views

Periodically monitor if record is not updated using Node, Event and setTimeOut

Here is my scenario: Every user checks in every five minutes. If some user doesn't check in after 5 minutes, I should be able to keep track of it. If some user doesn't check in N number of times, an ...
12
votes
4answers
996 views

Rubik's cube timer & scrambler

This uses a linked list to store the data. I used a linked list as it's the only type of data structure that I know currently. Using chrono, I can get microseconds ...
5
votes
0answers
64 views

Precise timings with low jitter via RDTSC (for x86 and x64)

The Win32 API has a so-called 'high performance counter' (QueryPerformanceCounter() and friends) but often it is neither precise enough nor reliable enough, due to ...
1
vote
1answer
114 views

Executing periodic tasks

I am writing a code in Golang to execute a periodic function (every 2 second). According to documentation and an example I have written two programs. Can anybody tell which one is better? Also, is ...
2
votes
2answers
76 views

Pomodoro Timer in Javascript

I've made a Pomodoro Timer application. All it does is countdown from a time in minutes given by the user to 0:00. It does this first for a session time, and then switches to a break timer and ...
3
votes
1answer
143 views

sleep() function [closed]

I wrote a sleep() function in C, but I don't know is it harmless and cross-platform. Here its code: ...
7
votes
3answers
485 views

Measuring performance of code using StopWatch

I have created a StopWatch class to measure the performance of any code. I use this StopWatch code in any of my multithreading projects as well. ...
12
votes
4answers
239 views

Simple stopwatch class

I'm not sure what the best way is when dealing with users calling start() multiple times or stop() before calling ...
2
votes
2answers
637 views

Writing C#'s analog of setTimeout, setInterval and clearInterval

I got tired of starting timer every time I need to do something simple as running some function 5 seconds after something in my code happens. So I tried to write a function (actually, 3 of them: ...
7
votes
3answers
360 views

Egg timer in Bash

I just started to learn programming, going through a lot of different tutorials, trying out different programming languages and I stumble in the same sort of questions all over the place. I give you ...
3
votes
0answers
44 views

A version of the Pebble Big Time watch face that also displays the date

I'm seeking style pointers, bugs, memory leaks, incorrect usage etc. ...
2
votes
1answer
109 views

MyTimer based on QTimer

I needed a timer that fires in intervals for a given duration when e.g. a button is pressed. The button can be pressed several times thus I thought it would be easiest to create a new timer for each ...
6
votes
1answer
73 views

Rate limiting function calls

I wanted to write a function that when applied to another would rate limit it, but permit all calls to eventually make it through. Comments and criticism welcome. ...
15
votes
3answers
598 views

“Ticker” for game timing

I designed a "Ticker" based on how I imagine Minecraft's tick system works. My ticker calls a method tickRate times a second and provides a Delta Time value (...
6
votes
1answer
133 views

Timer in pure JavaScript

I was working on a timer code in pure JavaScript and would like to know any pointers to improve: Features Start/ Stop/ Reset on click of a button. Set limit to clock. Update class name for warning ...
4
votes
2answers
97 views

Auctioneer calling “Going once… going twice… sold!”

I feel like the if-else combination isn't the most optimal and I'm also not sure if I need a loop ...
0
votes
1answer
515 views

Case of System.Timers.Timer vs System.Threading.Timer

I have a console application that I want to use to send an email notification every day at some time (call it 06:00 local time). To do so at the moment I am using a ...
2
votes
3answers
118 views

Simple JavaScript timer function

I've written a timer to start when the page loads, and to stop when the user clicks a "finished" button: ...
2
votes
0answers
70 views

Pomodoro Timer via setTimeout()

I've made my attempt to code timer entirely by hand using jQuery. No external libraries to manage time at all. ...
4
votes
1answer
134 views

Creating a Tomato Timer

I have completed a FreeCodeCamp exercise to create a tomato timer and chosen to do so with vanilla Javascript. Although it works, I don't like in how many places I am checking against two state ...
3
votes
1answer
73 views

Javascript: timer function

This is a function I made for a timer that counts down and performs a callback at the end. It seems to work fine, but I think the code is not very clean and has some unnecessary bits; also I would ...
3
votes
1answer
94 views

Ability System in my game

I'm writing a game in C# Monogame, and I've decided to make my project as modular as possible. GitHub At first, I've had a single project with a folder that's separated inside to other folders ...
6
votes
1answer
207 views

Task Reminder - Repeatedly notify every 6 hours

So I'm very much a beginner to Java and Android programming. I've worked a lot more with Python so I might have some quirks from there bleeding into my code here. I'd like a particular focus on ...
4
votes
1answer
1k views

Pomodoro Timer via setInterval

I'm hoping for some input on if my code is DRY or how I could have made it more efficient. I am pretty new in terms of jQ/JavaScript and this took me far longer than I care to admit. I will post the ...
6
votes
1answer
74 views

Creating an in-memory ViewCounter that commits to database every 10 minutes

This singleton is responsible for counting every pageview (called Routes in our case) we get by id, until the timer runs out and commits the results to the database in one query. Then the counter gets ...
11
votes
2answers
183 views

A low tech approach to measuring game speed

Whilst developing a game I needed a delay routine capable of doing delays ranging from 0.5 sec to just a few msec. The obvious choice was to use the BIOS delay function 86h on int 15h. In a true real ...