36
votes
Car crash reaction time
Some of the numbers might seem plucked out of thin air but they aren't
Still better have them explained. I can understand 3.6 and even ...
18
votes
Car crash reaction time
I suggest breaking the code into functions, so you can easily import your code into a Python shell and test that your computation is exact (and not just thinking it ...
17
votes
Accepted
Extremely simple timer class in C++
Keep solid picture of usage in your head
When creating a library, it is extremely important to always keep the intended usage in mind. If the usage syntax is disgusting, it is better to think of a ...
16
votes
Accepted
Progress Bar in C++
I wrote a simple main() function to test this:
int main()
{
show_progress_bar(100, "progress", '#');
}
I ...
13
votes
Car crash reaction time
It crashes if user input for speed_ms is not integer
If user presses any key before t = input("GO!! ") his reaction time is ...
12
votes
Car crash reaction time
If it's wet, the friction_coefficient will be lower. Which means that Bd will be lower (which is probably wrong).
It's ...
12
votes
Car crash reaction time
player_1 is read and assigned but never used.
If the user misspells wet (e.g. as Wet or as <...
10
votes
Accepted
Stopwatch class
First off, the obligatory recommendation that you use System.Diagnostics.StopWatch for this purpose, and not DateTime.Now (or ...
10
votes
Stopwatch class
Good effort.
A few small points, with lots of links to my blog along the way.
namespace Stopwatch
{
public class Stopwatch
{
Never name a class the ...
10
votes
Countdown control with arc animation
There are a couple of things which could be more consistent.
...
9
votes
Stopwatch class
You have done well. You have created a class for the Stopwatch which only responsibility is just exactly what a Stopwatch should do : Start, Stop and calculate the duration.
What I don't like are ...
8
votes
Accepted
A simple stop watch which I want to extend
Don't use member variables for temporary storage
Your class Timer has a member variable mvSession, which is unnecessary. It is ...
8
votes
Accepted
Digital clock with Python Tkinter
To start, it's crucial that you stop creating a brand new label ten times a second. Just modify the existing one. Also, this is so simple that a class is not called for. Move as much as possible away ...
7
votes
Accepted
CHIP-8 delay timer in C++
When doing emulation you should disconnect from the real world and only provide a abstract view to a world.
In other words don't use a real time clock instead simulate the timer by linking it to the ...
7
votes
Accepted
Async friendly Timer
The API would really benefit from some inline documentation (///), but mostly looks good.
Threading
I'm no expert but it looks fine to me. The only thing that is ...
7
votes
Countdown control with arc animation
1) DispatcherTimer is good for periodic UI updates, but it should not be used to measure time, because it is just not accurate enough. For precise time measurement ...
7
votes
Countdown Timer in Python
Before entering into the meat of the answer, let's talk about time accuracy for a bit.
For starter, time.sleep is not extremely accurate as it can be (a little bit)...
7
votes
Productivity/Timer app that uses twilio to send SMS-reminders
Ways of improving:
work_time and break_time as constant values deserve to be defined as CONSTANTS
...
7
votes
Productivity/Timer app that uses twilio to send SMS-reminders
RomanPerekhrest has brought up several good points that you should definitely follow.
One point that was not mentioned however, is the recursive way you call your ...
7
votes
Python analog clock with turtle - runs slow
Avoid import *; there's only a few symbols you need from turtle.
There's a lot of repetition in your hand logic. Consider factoring out a class that does the common ...
7
votes
Accepted
Heartbeats per minute in vanilla HTML JS
You have an off-by-one error! Notice that even if you tap a steady beat, the display will initially show a high bpm before asymptotically settling down to something approximating the correct value.
...
7
votes
Accepted
This is a simple stopwatch cli application with a few options
Check the return value of library functions
From the man page:
signal() returns the previous value of the signal handler. On failure, it returns SIG_ERR, and errno is set to indicate the error.
...
6
votes
Stopwatch class
You did actually very well, hovewer there's one major problem that would make your class unusable in production environment. Don't forget the DateTime.Now is a ...
6
votes
Accepted
Three versions of a counting-up timer in JavaScript
Performance is not a significant concern, since all three callbacks have very little code, and they execute only once per second. Rather, you should aim for clarity. In my opinion, Version 1 is ...
6
votes
Accepted
Pausable Timer Implementation for SDL in C
I don't see too much that I feel like complaining about.
Standard Types
In timer.h, you use Uint32. This is not a standard type. It comes from SDL, which in turn ...
6
votes
Accepted
Safe Dispose of Timer
Review
property Interval and methods ExternalStart, ExternalStart should throw ...
6
votes
Tick. Tick. *breathe* BOOM! - Setting up real, stable asynchronous callbacks with WinAPI Timers in VBA
First I'd like to say that this is impressive work, overall pretty squeaky clean... despite the adjustments needed to make it build on x64 :)
One enhancement I can see in terms of readability, would ...
6
votes
Time duration conversion with units
Looks pretty good; these comments are mainly nitpicking:
Error messages should be streamed to std::cerr, not std::cout. Whilst ...
6
votes
Accepted
Time duration conversion with units
Avoid defining your own constants
There's no need to use your own constants for the duration of a millisecond, second, minute and so on; just use the right ...
6
votes
Templatizing a Timer class
Time warp
Anything but std::chrono::steady_clock does not guarantee being monotonic and ticks having more-or-less constant time between them as time moves forward. ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
timer × 312javascript × 64
c# × 53
c++ × 46
java × 40
python × 38
beginner × 32
multithreading × 27
datetime × 23
performance × 18
c++11 × 18
c × 15
jquery × 14
game × 14
object-oriented × 11
python-3.x × 10
thread-safety × 10
animation × 10
scheduled-tasks × 10
swing × 9
benchmarking × 9
.net × 8
console × 8
error-handling × 8
winforms × 8