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
18
votes
5answers
4k views

Stopwatch template

It's often useful to be able to time code, for instance, to evaluate alternative approaches to the same problem. Because this is a thing I use frequently, I have created this Stopwatch templated ...
15
votes
1answer
1k views

Plot timings for a range of inputs

When writing Code Review answers, it becomes often necessary to measure how long the modified code takes vs how long the OP's code takes. I needed a nice way to visualize this as a function of the ...
5
votes
0answers
143 views

Scheduler built with observables v2 (follow-up)

It would probably be too easy if the old Scheduler worked as intended being that simple. But an eye-openig review showed that from time to time it'll miss one ...
8
votes
1answer
729 views

Timing analysis of many test cases in Python

I am learning about timing analysis in Python. I used time module before it was pointed out that timeit module would be better ...
3
votes
2answers
982 views

Stop Watch application

I've done the difficult dailyprogrammer challenge #2: Your mission is to create a stopwatch program. this program should have start, stop, and lap options, and it should write out to a file to be ...
37
votes
4answers
7k views

“How are you spending your time on the computer?”

I've made a Windows Forms application to track all of the processes running on my machine and it also saves the time an application is "active", an active application is the one that is on focus ...
18
votes
2answers
25k views

Portable periodic/one-shot timer implementation

Note: I have posted a follow-up question for a significantly updated version of this code. I have implemented a class that provides portable one-shot or periodic timers. The API provides a way to ...
8
votes
2answers
2k 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 first ...
11
votes
1answer
6k views

Timer to poll a Delegate

This is a followup to this where I was initially using a single thread and Thread.Sleep() to poll a delegate. I was recommended to use a timer and the ...
12
votes
4answers
3k 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 ...
7
votes
2answers
1k views

Homemade Stopwatch class

Here's some explanation for accuracy and neg_accuracy: It's meant to keep all the values in terms of what the user specified he ...
7
votes
1answer
248 views

Stop Watch Application 2.0

After the tips from my previous review. I have come up with these changes: Changed my braces to start on a new line Used the Single Responsibility Principle Return early whenever possible Use a ...
7
votes
1answer
5k views

Timer utilizing std::future

I have a Timer class executing a function in a specified interval: ...
5
votes
1answer
107 views

Scheduling using System.IObservable 2.0

As a follow up to this first attempt to create and use my own IObservable<T> implementation, this is version 2.0. The goal has been to correct the code where ...
10
votes
3answers
892 views

First Chess project

I'd made a project using pygame in python around 3 months ago. This was my first big project after I started learning how to program in college. Now I'd like to know just how good my programming ...
10
votes
1answer
869 views

Follow-up: Timer utilizing std::future

The previous code (as displayed in Timer utilizing std::future) is now: ...
9
votes
3answers
12k views

Extremely simple timer class in C++

A very bare-bones timer class created using the std::chrono library. I would like to know if any optimisations are possible and just to clarity, I am using MSVC (...
9
votes
2answers
19k views

Measuring Execution Times

I was wondering which time.time() of from datetime import timedelta was the quickest and best way to find how long a programme ...
8
votes
2answers
125 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 ...
5
votes
1answer
236 views

Inefficient Stopwatch

I have just finished a simple GUI stopwatch, but some of its code looks like it needs replacing. This is the code: Clock class (extends Thread): ...
4
votes
1answer
1k views

New year countdown

Here's some code I wrote quickly to get a nice millisecond countdown going. It displays the number of milliseconds until the new year in whatever timezone is next to be in 2015 are in in huge font, ...
4
votes
1answer
183 views

Countdown AppIndicator

I've decided to translate an old Unity AppIndicator I had written in C to Ruby, so I can practice coding with it (got a little bored with the completely beginner lessons I've been following, which I'...
4
votes
2answers
4k views

Measure a given method's execution time - follow-up

A long time ago, I've written a method that would allow me to measure the amount of time a method takes to run. I've decided to tweak this method and make use of TPL since measuring a method may take ...
4
votes
1answer
122 views

Scheduling using System.IObservable

With great inspiration from t3chb0ts ongoing work about scheduling, cron jobs etc. (last post here), I decided to make my own version of the Scheduler - using the observer pattern - as a learning ...
3
votes
1answer
192 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 ...
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 ...
1
vote
1answer
40 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: ...