New answers tagged timer
0 votes
Flutter Countdown Timer
A very simple example of using a generic CountdownTimer that is not related to the user interface. Just a few lines of code. import 'dart:async'; import 'dart:io'; import 'package:multitasking/misc/...
Best practices
0 votes
0 replies
0 views
How reliably and safely detect hardware timer overflow causing logic error
I will give you an example calculation. I will use hex values as it is easier to see where the overflow/underflow happens and we don't have to care about exact numbers. Simple example: Now: ...
Best practices
1 vote
0 replies
0 views
How reliably and safely detect hardware timer overflow causing logic error
Signed overflow is undefined behaviour, unsigned arithmetic is defined (C++ standard) as performed modulo 2^bits_of_your_type, so it technically speaking doesn't overflow. However, this doesn't seem ...
0 votes
How to create timer on JINT Javascript side
You can wrap Task.Delay() with a Jint promise, e.g. using Jint; internal class Program { private static async Task Main(string[] args) { TaskCompletionSource<object?> tcs = new ...
Best practices
1 vote
0 replies
0 views
How reliably and safely detect hardware timer overflow causing logic error
It's simple to extend the timer using another 32-bit register: if (!++ticks) ++overflow; In ARM assembly, that's just one extra instruction. The overhead in testing is slightly more, but still in ...
Best practices
0 votes
0 replies
0 views
How reliably and safely detect hardware timer overflow causing logic error
Could you please elaborate? Do you mean that unsigned long is simply the wrong data type for the problem or that you don't see the logic bug described in the question? Or something else?
Best practices
0 votes
0 replies
0 views
How reliably and safely detect hardware timer overflow causing logic error
Thanks Andrey, your suggestions are much appreciated. Yes, 490 thousand years will certainly suffice. The application controls truncation of an AC waveform so is very sensitive to timing. I'll just ...
Best practices
1 vote
0 replies
0 views
How reliably and safely detect hardware timer overflow causing logic error
you are using unsigned long so overflow is well defined and I do not see a pro0blom.
Best practices
1 vote
0 replies
0 views
How reliably and safely detect hardware timer overflow causing logic error
and 2) are the same thing. 32-bit time counter + overflow counter is exactly the same as single 64-bit counter; except in single 64-bit case the compiler would do the job for you. It also does ...
0 votes
SwiftUI - How to Make A Start/Stop Timer
If you would like more modern solution (iOS 17+), without the publishing hassle and outdated Combine framework, yet maintaining start/stop functionality, you can use something like this: import ...
0 votes
DispatcherTimer and Timer
why the System.Threading.Timer is loosing so much time approx. 3sec. in 5 min. the reason is race condition - to solve this problem you should marshal the call back to the UI thread either using a ...
Top 50 recent answers are included
Related Tags
timer × 19666c# × 3804
java × 3357
javascript × 2610
android × 2287
multithreading × 1593
python × 947
jquery × 904
swing × 897
swift × 835
ios × 786
c × 773
c++ × 770
countdown × 742
.net × 622
winforms × 584
html × 513
vb.net × 457
time × 427
php × 420
timertask × 416
linux × 399
asp.net × 390
countdowntimer × 314
wpf × 294