Skip to main content

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
3 votes
1 answer
189 views

The code shown below goes back to the tutorial How to Use a Timer in Tkinter. I first simplified the tkinter import by restriction to Python 3. Then I found a ...
Wolf's user avatar
  • 375
0 votes
0 answers
32 views

I am learning about refs by using the React learning resources and encountered this challenge: https://react.dev/learn/referencing-values-with-refs#fix-debouncing The provided solution uses a ref to ...
Rizza Keen's user avatar
5 votes
2 answers
304 views

My goal of this when I started writing it was simply that it be able to record thousandths of a second in a very performant and accurate way. I'm not sure I have achieved the performance aspect of ...
lull's user avatar
  • 53
3 votes
1 answer
252 views

I have a Timer in my View right now, but I want to move it outside to my ViewModel-class. I have experimented a bit and came up with a working solution. The code works and produces expected output, ...
irrbloss's user avatar
  • 133
6 votes
1 answer
1k views

I was working on a project recently, where I needed to process some tasks periodically, but the execution of those tasks could not overlap with one another. ...
ARickman's user avatar
  • 698
8 votes
1 answer
174 views

This is my first time trying out C. Simplicity was the main objective. Signals are not handled and memory is not freed (program is very small, and the OS should take care of that when program exits). ...
basedN1F48A's user avatar
3 votes
1 answer
121 views

Again, here is the previous question. I have (re)revised my custom scoped timer using the valuable feedback I got from a helpful member of this community. However I feel the need to ask this question ...
digito_evo's user avatar
3 votes
1 answer
2k views

I created this script because the Spotify desktop app doesn't have a built in sleep timer, and I needed one. I made it as easy to use as possible, and it can close other programs because it asks for ...
user avatar
5 votes
2 answers
269 views

Here is the original question. I have extensively revised and redesigned my custom scoped timer for my needs using the feedback I got from two helpful members of this community. However I was told to ...
digito_evo's user avatar
5 votes
1 answer
322 views

From an integer X representing a time duration in seconds produce a simplified string representation. For example, given X=100, you should output: "1m40s" Use the following abbreviations w,d,...
Leandro Tabak's user avatar
0 votes
1 answer
136 views

I created a function using requestAnimationFrame loop that works pretty much like the plain JS setTimeout function (except that ...
gaspar's user avatar
  • 173
5 votes
3 answers
2k views

Attached is a fun little snippet demonstrating a button to be clicked along with your heartbeat and see how many beats per minute you're at. This is a mwe of the concept, any feedback is appreciated. ...
async await's user avatar
5 votes
1 answer
780 views

My goal is to have a timer function that operates from the bash linux command line. I am looking for review and feedback. Printing the expected number of characters (dots, dashes, or bars) is nice-...
Steve T's user avatar
  • 183
4 votes
1 answer
3k views

I've implemented a timer thread whose job is to call functions at a certain interval. The functions may be called multiple times if their interval > 0 millisec otherwise only one time. Even if the ...
Daya Shanker Prasad's user avatar
4 votes
2 answers
202 views

C++ Timeit A quick C++ library to measure/compare code execution time Features Easy include and just call timeit() or ...
Maysara Elshewehy's user avatar
2 votes
1 answer
606 views

The method to overwrite the same line is well known and I use it for countdown, but what about when the next output string has a different size and will be generated by a single print? That's the ...
Digital Farmer's user avatar
5 votes
3 answers
529 views

I'm making a timer class in C++. This is the overview: ...
Alex CB's user avatar
  • 175
2 votes
1 answer
228 views

I know that this program is not very outstanding, but I'm learning Python and decided to publish this code in order to get some advice and parting words and overall evaluation of the program. This is ...
Feraun's user avatar
  • 51
2 votes
1 answer
238 views

I'm trying to write a program that will check if a window is opened or not, during a given time. I was able to do that, but now I'm trying to make my code look cleaner. I don't like how I implement ...
Minh Hoang's user avatar
6 votes
3 answers
1k views

I made a python analog clock program with turtle. The problem is, it takes about 1.4 seconds to loop, so it only moves the second hand every 1.4 seconds. Its probably cuz my computer is slow... ...
Kovy Jacob's user avatar
8 votes
0 answers
850 views

Motivation I am interested in optimising the execution time of code with short (fast) execution times on the order of microseconds (µs), but that will be used with high frequency (e.g. like ...
vbAdder's user avatar
  • 201
2 votes
1 answer
387 views

Basic implementation of a leaky bucket, the idea is you call it by saying I will allow e.g. 5 login attempts per 60 seconds. ...
CaptainCodeman's user avatar
6 votes
3 answers
2k views

Update Feb 2023 This solution is no longer maintained here or on GitHub, mainly because I do not need a timer solution anymore. As seen below, the only purpose of this approach was to get a reliable, ...
Cristian Buse's user avatar
3 votes
2 answers
2k views

I want to make a function to retry calling callback n times until it return TRUE; Here's my current code: ...
gidiwe2427's user avatar
4 votes
9 answers
814 views

I've made a little library where I add some functionalities from time to time that I miss in the Java standard library. I am sad that the Java library for example has no stop watch class that allows ...
Dexter Thorn's user avatar
  • 2,174
3 votes
1 answer
853 views

A very simple stopwatch. Intended to be used for simple benchmarking when you want to do a task several times, but exclude some setup code from the benchmarking. Some things I have already considered: ...
klutt's user avatar
  • 913
3 votes
1 answer
1k views

I have the following problem. I want to write a class that handles events and passes it through but reduce its number if there recently was an event. Basically it is debounce. However there is a ...
Irdis's user avatar
  • 131
7 votes
2 answers
5k views

I recently was asked to upgrade some C++11 code to add a feature by which the user can set a time duration from the command line of the program. The requirement was to have a default time of 1500 ms ...
Edward's user avatar
  • 67.2k
6 votes
3 answers
1k views

I am trying to implement a priority-based timer where certain events are fired out based on their expiry and the priority. So if there are 3 timers with the following expiry time and priorities Timers ...
xyf's user avatar
  • 508
2 votes
1 answer
975 views

I created a watchdog/notifier in C++ and wanted to make it better so it could be used by multiple people. The idea is that there is a timer class and event. client create events and pass a lambda ...
Kumar Roshan Mehta's user avatar
7 votes
1 answer
978 views

While learning about python tkinter, I decided to make a digital clock: ...
TheHappyBee's user avatar
3 votes
0 answers
295 views

I have written a class library for creating timer-based bacground operations in .NET projects. The idea is to be able to create and manage (start/stop/resume/cancel) recurring background operations ...
TDMR87's user avatar
  • 31
3 votes
0 answers
89 views

I am using a function that returns a list of all files (full path for each of them) with the given extension in the given folder and all subfolders. As the process is quite long and user can get ...
SlavaB's user avatar
  • 31
2 votes
3 answers
7k views

This works for me, but is this the right way to create this timer? I might be naive about this but I think this is close to perfect in pure JS. What would be the drawbacks of using this Timer compared ...
Myke24's user avatar
  • 21
3 votes
1 answer
749 views

I'm attempting to implement a high resolution class used to time the execution time of functions in Windows. After using this documentation, I have come up with the following: ...
George Tian's user avatar
2 votes
1 answer
86 views

Please review the code below, which detects discontinuities in Windows system clock in long-running programs. ...
Dale's user avatar
  • 121
4 votes
2 answers
918 views

I've been tasked with writing a function that executes a passed function every interval, passed to the function by the user. Below is the code, and how to call it: ...
Ben A's user avatar
  • 10.8k
1 vote
1 answer
133 views

I use this in my Blazor application, letting other services send errors or warnings to this AlertService. The service triggers an update of a component which simply displays the messages, errors in ...
Metallkiller's user avatar
4 votes
0 answers
185 views

I've written a little clock implementation in Java Swing. It now seems to work flawlessly after having terrible Swing specific timing problems. Please indicate if this is the way to draw the clock and ...
Maarten Bodewes's user avatar
3 votes
0 answers
64 views

I'm new to Go and have a use-case for periodically executing an async work-function. I want the interval between work-function executions to be constant (not the time between one finishing and the ...
geofflittle's user avatar
8 votes
1 answer
246 views

I'm learning OOP and also trying to learn and implement some design patterns. This question is a follow-up of Stopwatch interface OOP (Vanilla JS) The app is available in https://nacho-p5.github.io/ ...
nabla-f's user avatar
  • 183
8 votes
3 answers
439 views

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 ...
nabla-f's user avatar
  • 183
2 votes
0 answers
66 views

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 ...
tameer kenaan's user avatar
1 vote
2 answers
856 views

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 ...
code_fodder's user avatar
0 votes
1 answer
973 views

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 ...
qqqqqkks's user avatar
  • 161
2 votes
2 answers
107 views

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 ...
JSScratchDouble's user avatar
2 votes
1 answer
2k views

I have created a timer with GUI in Java. Here's the code: ...
user avatar
3 votes
1 answer
3k views

I have made a simple Timer class used for scheduling tasks. While defining the interface, I have followed the interface of a ...
NutCracker's user avatar
3 votes
1 answer
458 views

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 ...
user avatar
6 votes
2 answers
363 views

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/...
Red Mango's user avatar

1
2 3 4 5
7