Questions tagged [timer]

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.

Filter by
Sorted by
Tagged with
7
votes
3answers
114 views

Stopwatch interface OOP (Vanilla JS)

I'm learning OOP and the first exercise of the course was to made a Stopwatch class. I did it really fast and decided to make an interface for this little app. I created the interface. Basically I ...
6
votes
2answers
347 views

Carousel image slideshow script

I have learned to make a carousel image slideshow script with JavaScript. I think it's better to learn it from the basic than just from the framework (instant script), but I'm a newbie. I wrote this ...
4
votes
1answer
81 views

Pomodoro countdown timer synced to the clock

This countdown timer is supposed to: be synced to the user's clock at every hour and half hour, will start a 25 minute countdown followed by a 5 minute break The code works but I question its ...
2
votes
0answers
29 views

Refresh the List box with new rooms from the server every 3 seconds [closed]

So i have a server which I send a Request to and it sends me back a list of rooms,Now i made a window for joining rooms and I'm trying to refresh it every 3 seconds but when i use the Timer thread to ...
1
vote
2answers
45 views

sleepless timer that does not lose time and handles spurious wakes

I have written a timer class. Here it is in all its "glory" with some functions around it to test it: https://rextester.com/LQSXUA43758 Below is the class on its own, note it also relies on ...
1
vote
3answers
15k 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 ...
5
votes
1answer
306 views

Stopwatch utility class in Java

I am looking for input on my code for a Stopwatch utility written in Java. The stopwatch uses System.nanoTime as its time source. In general it works similarly to ...
1
vote
1answer
64 views

Run a timer while waiting for user input [closed]

I am making a C# console maths test where the user answers maths questions. I am trying to add a timer to the test, I have managed to make a timer but when I run my code it becomes a mess! Here is ...
3
votes
2answers
744 views

Fading HTML elements in and out after timed delays using jQuery

I recently launched my first website, and despite being very proud of how far I've come, I know that my code is more "I got it to work" than "It works the best that it can." I'd like some criticism, ...
3
votes
2answers
39 views

Simple Timer Program

I have built a timer program in JavaScript. It decrements one counter every second, and if that counter is at zero, it decrements another counter, and sets the first counter to 59. If the second ...
1
vote
1answer
79 views

Timer in Java with GUI

I have created a timer with GUI in Java. Here's the code: ...
1
vote
1answer
112 views

UserScript to Highlight tab for queue item

It may seem a bit obsessive and/or pedantic, but the following script allows me to see when posts are ready for reviewing. I developed this UserScript for use with TamperMonkey to allow me to have a ...
12
votes
1answer
419 views

Tick. Tick. *breathe* BOOM! - Setting up real, stable asynchronous callbacks with WinAPI Timers in VBA

WinAPI Timers can be quite tricky to work with, as anyone who's tried to use them and fallen foul of one of the many pitfalls probably knows. Problems such as screen freezing, crashes, uncontrolled ...
3
votes
1answer
49 views

Plot timings for a range of inputs MkII

To celebrate questions getting more reputation points per upvote, I revisited my previous question, Plot timings for a range of inputs. Since the time of that original question (more than two years!),...
3
votes
1answer
70 views

Timer for scheduling tasks in C++11

I have made a simple Timer class used for scheduling tasks. While defining the interface, I have followed the interface of a ...
5
votes
2answers
59 views

Report time on whole hours

Report time at whole hours ...
5
votes
1answer
6k views

Countdown timer in every table cell

I am making countdown app with multiple records, so I am using UITableView to show that records and countdown dates. What I do is just take one timer and reload cells on every second. Is this a best ...
3
votes
1answer
146 views

ValueAnimator for IOS - Did I butcher it up?

I am trying to make an IOS tool similar to Android's ValueAnimator... more or less This is useful for situations where you simply want a value to "animate" over time, but rather than necessarily ...
5
votes
2answers
320 views

Productivity/Timer app that uses twilio to send SMS-reminders

I wrote a timer app in python using both twilio and the timer module; sends an sms to my phone after a certain amount of time has passed. While it works without a doubt, I wanted to gather some ideas/...
3
votes
2answers
18k 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: ...
1
vote
1answer
72 views

Suppress API call in Redux Saga based on a timer

I have an API that provides data that is updated on an infrequent schedule, about once every 2½ minutes on average. Assuming that it's okay to fetch only as often as every 2½ minutes or less often, I'...
3
votes
2answers
3k views

Timeout implementation of fetch

After doing some research on google i didn't find any good info on how to implement timeout with fetch (looks like there are multiple proposals but that's about it so nothing has implemented it). For ...
1
vote
1answer
677 views

React continuous polling

I have a Notifications component in my React app, which continuously polls the server for new notifications. The app uses Redux for storing notifications. When a new notification is received, it is ...
4
votes
0answers
79 views

React - pomodoro clock

I'm looking for some feedback on a pomodoro clock that I recently wrote with React. I'm pretty new to React and coding in general. I followed a couple of online courses, but I'm mostly self-taught. ...
2
votes
0answers
68 views

RxJs observables pipes SwitchMap and async with typealong search input

I'm using RxJs for type along search, I setup an observable to emit a value after 1 second so it behaves like http with delay. I subscribe to it via the async operator in the template, the component ...
2
votes
2answers
307 views

A simple stop watch which I want to extend

I am making a very simple stopwatch functionality as below. New will start the timer. Pause will suspend the watch. Start will restart again. Session will return the duration. ...
1
vote
0answers
36 views

Limit framerate [closed]

I have made this class. Not sure if there is anyway to make it better. It seems to work alright half the time, but other times frames jump up higher then the set limit around 30frames more if i set it ...
3
votes
2answers
138 views

A little C++ program to have timed rounds for a game

I know it could be better, but I’m new to C++, so I don’t know many of the tricks, along with some of the includes that are already obsolete. This program asks for names as input, adds a time for ...
4
votes
1answer
67 views

Single-thread Task Scheduler with type erasure and allocator-aware

I made a task scheduler to practice allocators and type erasure. With my project, you can delay execution of any callable (functions (using std::ref), lambdas...) ...
6
votes
2answers
1k views

Safe Dispose of Timer

I am currently refactoring a larger solution where the compiler gave multiple warnings about disposing the used System.Timers.Timer instances. The timers are ...
6
votes
2answers
226 views

pydoro - terminal tomato timer

I've recently created a tomato timer for terminal. It's hosted in github. My concerns are how Pythonic my code is? Is the way I'm handling state transitions good? Which areas of the text user ...
4
votes
1answer
57 views

timer struct for fixed timestep iterations in C (gcc)

I was toying with a way force fixed timestep loop iterations in C and came up with a fairly simple timer struct (quite different from Pausable Timer Implementation for SDL in C and decided to put it ...
2
votes
1answer
55 views

Throttling promise execution (API requests, etc)

I was working on a client for a remote api and realized that I needed to throttle requests at a maximum rate of 4 Hertz (4 requests per second). I wrote a simple typescript class to do it and wanted ...
8
votes
1answer
360 views

Cookie Clicker Switches

In Cookie Clicker there are Golden cookies, and Wrath Golden Cookies. Golden cookies are Clickable cookies that randomly appear, and when clicked they give Bonus cookies, or temporary boosts to ...
2
votes
3answers
8k 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 ...
4
votes
0answers
69 views

Game clock with configurable rate

Edit: Licensed source can be found here. The intent behind this class is to allow different game systems to run at their own clock rate. The physics integration rate should not be connected to the ...
3
votes
1answer
242 views

A rather accurate VBA stopwatch

Intro Related, related I'm trying to come up with a neat, accurate way of timing VBA code, as I'm yet to find a method to do this in VBA directly (without plugins etc.) The general idea was to ...
4
votes
2answers
151 views

JavaScript component to display ephemeral notifications

I would like to improve my code and organization of JS files so I'm wondering if you guys could tell me what I could do better. I've included a small but typical example of how I often use components. ...
1
vote
0answers
280 views

Timer queue with chrono

I would like to make the timer queue: 1. Each timer has id, time expired and callback to call 2. Queue stores timer and execute the callback of each timer whenever expired. Here is my code and demo: ...
7
votes
1answer
135 views

Quiz game with timer

This is my first Go program. I would like to know what could be improved, what is done wrong, and anything else that I should know. The CSV contains 10 questions with the 10 answers separated by a ...
3
votes
1answer
1k views

Tkinter stopwatch

As part of a personal project, I wanted to make a stopwatch with Python. I wish to show my friend but at the moment it is a little messy and long. Is there any way to make it more compact or easier to ...
8
votes
2answers
149 views

Pausable Timer Implementation for SDL in C

Problem I've written a timer module in C for an SDL game. I'd like to get some eyeballs on. I wrote this for 2 requirements: I needed a timer that would signal on an elapsed interval, AND that was ...
2
votes
1answer
2k views

A countdown clock in TypeScript

The gist of the code is, you give it a date, it will start counting down how many days, hours, minutes and seconds left by emitting an event 'countDown' and once 0 is reached 'expired' event is ...
4
votes
2answers
228 views

Sleep until specified time

It's sometimes useful to pause until a specified time (but inconvenient to use at or the like), so I wrote a tiny script to wait until a user-specified time point ...
4
votes
1answer
226 views

C# Timed buffer

Purpose of this code is to have buffer which will batch messages based on configured timeout. For example, one thread will continuously push data to this buffer, and when configured timeout pass, it ...
5
votes
1answer
829 views

Algorithm to find the number of years, months, days, etc between two dates

I've been working on this one for a while. Took me a while to figure out all the logic rules for dates and months. The goal of this method is to return the number of years, months, days, hours, ...
1
vote
1answer
46 views

A simple Java class for implementing code stop watches - follow-up

I have received a nice answer for this post. Now, it is my attempt for some improvement: ...
1
vote
1answer
57 views

A simple Java class for implementing code stop watches

(The next iteration: A simple Java class for implementing code stop watches - follow-up) Here is my attempt at more convenient benchmarking (yes, this time I am aware of JVM warmup, etc.), and it ...
12
votes
2answers
12k views

Progress Bar in C++

I made a simple progress bar with percentage counter for console applications in C++. Below is my code: ...
5
votes
2answers
371 views

Frame limiting in an SDL game

I am a relatively novice programmer, and I am taking steps into graphics programming. I am writing a quick pong clone and want to cap the FPS to save system resources. This is how I have implemented ...

1
2 3 4 5 6