844 questions
-2
votes
2
answers
135
views
C# Least resource/processor intensive for accurately blocking thread over short periods of time
I'm developing a console application that periodically executes two threads: one for a tickEvent function and another for updating the console display. Currently, each thread simply blocks on a ...
-2
votes
1
answer
157
views
How do I stop a stopwatch in "catch" block
I am trying to get response time of an Oracle query and using StopWatch to accomplish this.
I am also trying to catch connection timeout and log how long it took before timeout occurred and having ...
0
votes
0
answers
30
views
Flutter: Multiple timers losing precision after screen lock/unlock
Problem
I'm developing a Flutter application with multiple simultaneous timers. These timers need to keep running correctly even when the user:
Navigates away from and back to the page
Closes and ...
0
votes
1
answer
61
views
Stopwatch Ticks-Based Delay Inconsistent on Linux-ARM Compared to Windows
I'm working on a project where I use a Stopwatch for tick-based precise delays in .NET. The application works flawlessly on Windows, but when I run it on a Linux-ARM platform (e.g., Orange Pi), the ...
1
vote
2
answers
80
views
Why is my setstate function causing other functions to malfunction in react.js?
const [lap, setLap] = useState([]);
function start(){
if(!isStart){
starting = Date.now() - elapsed;
isStart = true;
timer = setInterval(update, 1000);
...
0
votes
1
answer
149
views
Can't find unit "System.Diagnostics" in TMS WEB Core
I'm trying to use TStopwatch from the System.Diagnostics unit, but it's not finding it. I'm getting the following error:
[Error] can't find unit "System.Diagnostics"
I know most of the ...
0
votes
1
answer
42
views
React Native stopwatch implementation slow on iOS
I have the following stopwatch implementation
import { useState, useEffect } from 'react';
import { Text, View, StyleSheet, Button } from 'react-native';
function TimerComponent() {
const [isActive,...
-1
votes
1
answer
55
views
Timing Code segments execution time inside a large method
I would like to know how long it takes to run many code segments inside a large method.
I use System.nanoTime() to record the timestamp. Afterwards, I subtract two timestamps, such as nano2-nano1, to ...
0
votes
0
answers
45
views
Is there a way I can make stopwatch but having both timer up and down method?
`countDown is completed, when i want to start the timer again the timer starts from the vlaue where the countDown was clciked.
so, i want a solution that will help me to start the timer from the ...
1
vote
1
answer
63
views
Stopwatch localstorage for resume time React JS
I'm building a web app that has a stopwatch feature, I developed it properly but did not store data(local storage). So, when the user re-loads and closes it, it will start from 0.
I want to keep this ...
0
votes
0
answers
103
views
How to start stopwatch again after restarting its time?
So I'm just starting to learn JavaScript, like its syntax and logic, therefore I'm still not implementing anything on a web page, just playing with the console before doing any web development with JS....
0
votes
1
answer
153
views
Tkinter Display Stopwatch hours, seconds and minutes
Trying to properly display currently running stopwatch time so it shows Hours:Minutes:Seconds after I press the start button. My code works only until it reaches a minute then it displays just a 1, I'...
0
votes
0
answers
227
views
why the results of Benchmark and StopWatch so different?
i want to measure a method's performance and use the two different way, but the results is confused me.
Method 1:
new Test().Main();
public class Test
{
public void Main()
{
long ...
0
votes
3
answers
201
views
Why is this timer / stopwatch off eventually after about 15 minutes, 5 second diff
I found [this article] that shows how to build a stopwatch / timer and after about 15 minutes there's 5 second gap between my physical timer (good battery; physical timer goes ahead 5 seconds)
async ...
1
vote
2
answers
94
views
why i should click twice when i want to play againt my stopwatch after reset it?
i've try to built stopwatch from freecodecamp tutorial, when i add feature to reset it i realize that i should click twice to play after reset it.. any answer or solution for it? btw its my first ...
-2
votes
1
answer
52
views
Stopwatch until correct imput is enterd
I want to make a stopwatch that count how much time it took you to enter a correct imput. Are there modules that can help with is?
I have already tried using import time and import timer
I am making a ...
1
vote
1
answer
161
views
Java permanently running Task to check time
I have written a task that runs as Scheduled (every Second). I need this scheduled method to monitor the lifetime of a bearer token.
I'm new to Java and wondering if there isn't a better, more elegant ...
0
votes
1
answer
41
views
How to creating a an which counting work time
I am developing an app which count time of working when user click start button starts the work when click button end work, ends work. App should count time even if the app is killed or phone is down. ...
0
votes
2
answers
115
views
Why is the first timed function always measured to be faster with `Stopwatch`
I am trying to establish is iteration or recursion is faster in C#. However, on a simple test, I cannot seem to get trustworthy results using StopWatch.
Code:
internal class Program
{
// ...
0
votes
0
answers
53
views
Python TKinter - Reloading frame to change the values of label
I've been working on a Stopwatch project with UI. I built the UI using my novice skills in TKinter. I am trying to find a way to change the text of the label which prints the new time every second.
My ...
0
votes
1
answer
41
views
Flutter: Integer underflow error when using stop_watch_timer package
I'm trying to incorporate a stopwatch into my app and I'm using the stop_watch_timer package (https://pub.dev/packages/stop_watch_timer). My issue lies with 2 buttons I'm adding; one to add 5 minutes ...
0
votes
1
answer
47
views
stopwatch html keyEvent listener to keyup and keydown
I want to make a stopwatch that starts while spacebar is up, and stops when spacebar is down.
However, it starts right after i have stopped it because the start function is called when the spacebar is ...
0
votes
2
answers
143
views
Why does the Stopwatch value change by an order of 10 with a Thread.Sleep?
I'm seeing this very strange behavior with the Stopwatch object that I can't explain, in my code. I wrote this very simple application to reproduce the behavior and it's still there. In a brief ...
0
votes
2
answers
80
views
Js Stopwatch dont start again once i reset
i start studying Js and i made this Stopwatch, but if i press reset, the stopwatch dont start again, unless i f5. I've tried some things but nothing seems to work, dont know what to do. I've seen ...
1
vote
1
answer
84
views
Hello guys, I want the reset button of Stopwatch to be disabled at initial stage
I am trying to design a perfect stopwatch. I have tried and it is working properly. But, I want the reset button to be disabled at initial stage and when the count had begin by using start button ...
0
votes
0
answers
52
views
Taking user input while running while loop
So I am making stopwatch with c but I wanted to be able to take user input while the stopwatch is running.
`
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <...
0
votes
1
answer
124
views
Why using Stopwatch in Blazor Server App cause slower code execution
I have a Blazor Server App .Net7 with a single page with this code:
@page "/"
@using System.Diagnostics
<PageTitle>Counter</PageTitle>
<button @onclick=OnCalcClick>Count&...
0
votes
2
answers
1k
views
C# Stopwatch to calculate loop time for function
I am not familiar with the C# stopwatch class. I am trying to find elapsed time for a function. When I call a function again I need to get the total time since the last call. How Should I do it?
I ...
0
votes
0
answers
122
views
Making a stopwatch ( user input change size style ) using assembly 8086
error on word byte hour [org 0x0100]
I am working on a project in assembly.(stopwatch user input change style and size ) I am working in (in 16 bit assembly in emu8086).
I have been working on this ...
0
votes
1
answer
121
views
Stopwatch inconsistent behavior when initialized using StartNew()
Doing some performance tests I find the following behavior that seems wrong or counterintuitive.
Does anyone know what can be due?
The following occurs:
If I initialize a watch with StartNew() the ...
1
vote
1
answer
2k
views
How can I interact with a child Stateful Widget from a parent Stateless Widget?
Context :
Say I have a custom DisplayElapsedTime Widget which is Stateful and holds a Text Widget. With a Timer, every 1sec, the text value is updated with the current elapsed time given by a ...
0
votes
0
answers
45
views
how use timer, to create a stopwatch without gui/jframe?
package primer;
import java.io.IOException;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
...
0
votes
0
answers
375
views
stopwatch in .NetMaui is not accurate
Hi The stopwatch that I have made is not accurate(millisecond precision) - it is slow. How can I change that? I also would like to make timer counting down. There is literally no tutorials or any ...
-3
votes
1
answer
170
views
C# - Stopwatch timers not adding up [closed]
There's a piece of code I've been fiddling with to see if I can speed it up because it definitely shouldn't take 3.8 to 4.4 seconds to process about 1400 UserPrincipals.
I've used stopwatches to time ...
1
vote
2
answers
107
views
How do I replace the console message without it disappearing so fast?
I tried to make a stopwatch in the console, but the message kept on clearing before I had time to read it.
I tried increasing how long the Timeout function would go, but for some reason, it didn't ...
1
vote
2
answers
2k
views
Adding Stopwatch to all functions of C# project
I have a C# project that uses a lot of functions. I want to make a simple test with stopwatch.
But I don't want to add stopwatch to every function one by one.
I am looking for a way to add stopwatch ...
0
votes
3
answers
630
views
JavaScript stopwatch being slower than expected
In my quest to become a JavaScript developer and as an F1 fan, I had to make a stopwatch, to track reaction time. The problem I stumbled upon, and it seems to be the case in many tutorials I've seen, ...
-2
votes
1
answer
1k
views
I wanna make a stopwatch with python
import tkinter as tk
import time
timer = 0
def startTimer():
if timer == 0:
time.sleep(1)
elif (running):
global timer
timer += 1
timeText.configure(text=str(...
0
votes
0
answers
75
views
count down in flutter( not depending on device time)
I'm building a flutter app where I want to restrict some of the users for a week and also show them the remaining time in days and hours so when the apps get close the timer should never get stopped. ...
0
votes
3
answers
1k
views
Stopwatch with an async action which awaits calls from a database
How can I properly use the Stopwatch class with an async action event that awaits calls to my database asynchronously inside an async Post method on DotNet Core ?
Why
To time my code and check for ...
1
vote
1
answer
430
views
javaScript code working only in the first iteration of loop
I am trying to create stopwatch for multiple users with php and javascript, i am using mysql DB for users.
When i click on on user the stopwatch will start but for others it is not working.
I tried ...
0
votes
2
answers
776
views
Stopwatch Timer is slower than normal time
I want to make a stopwatch in JavaScript that could count milliseconds, seconds, minutes, and hours. The problem is that it seems to not go at the proper speed, meaning that when I compare it to other ...
0
votes
1
answer
739
views
How to create a stopwatch lap time function in Javascript
I am trying to create a stopwatch app that displays lap times. Currently I have it displaying the time when the lap button is clicked. However, I want to display the difference between time a and time ...
0
votes
2
answers
111
views
is there a way to somehow hold a keypress in js
So what I'm trying to do is to self replicate a Rubik's cube timer like cstimer.net
What I do is detect a spacebar key press and it is meant to start a timer, however it only adds 1 millisecond at a ...
0
votes
0
answers
105
views
Seconds Counting in Milliseconds
I've been coding a Stopwatch app in C#, but have encountered a problem. The Seconds seem to be counting in milliseconds.
Code:
private void timer1_Tick(object sender, EventArgs e)
{
...
1
vote
1
answer
111
views
Tkinter stopwatch stops with 1 second delay
When you press "reset" button, the stopwatch is supposed to stop and reset, but instead it sets digits to zero, then adds one more second and ends up with 00:00:01.
The same with "stop&...
0
votes
1
answer
530
views
Making a stopwatch counter with user filled data and with PAUSE/RESUME and RESET functionality
Two input field "minute" and "second" is given. The value of the "second" field can exceed 60. A stopwatch needs to be created starting from the above timings.
Eg. If the ...
1
vote
2
answers
950
views
Javascript Stopwatch. Need help to store my timer and when page refresh to keep the time and continue from there
I have a working stopwatch. When I click start button the stopwatch is starting and when I click pause button the stopwatch is paused. What I would like is when I refresh my browser to keep the ...
1
vote
1
answer
658
views
Flutter stopwatch running slower than expected
My stopwatch is running 0.5x slower than actual time
(e.g. while the real time is 1 minute, the stopwatch shows ~34 seconds).
Here is the Provider code:
class TimerState extends ChangeNotifier {
...
0
votes
1
answer
62
views
Did a stopwatch using time libraries, it worked as expected, but it returns none also [duplicate]
I'm new to python, so I was following a few tutorials to understand how to do something I liked to do. A stopwatch returning not only the time passed but also the time it started and finished. My plan ...