timer

java.util.Timer: Is it deprecated?

谁说胖子不能爱 提交于 2019-12-17 09:31:55
问题 I read in a comment to this answer and in many other questions about scheduling (sorry, no references) that java.util.Timer is deprecated. I really hope not since I'm using it as the light way to schedule things in Java (and it works nicely). But if it's deprecated, I'll look elsewhere. However, a quick look at the API docs for 1.6 doesn't say anything about it being deprecated. It's not even mentioned in Sun's Deprecated List. Is it officially deprecated * and if so, what should I use

java.util.Timer: Is it deprecated?

陌路散爱 提交于 2019-12-17 09:31:27
问题 I read in a comment to this answer and in many other questions about scheduling (sorry, no references) that java.util.Timer is deprecated. I really hope not since I'm using it as the light way to schedule things in Java (and it works nicely). But if it's deprecated, I'll look elsewhere. However, a quick look at the API docs for 1.6 doesn't say anything about it being deprecated. It's not even mentioned in Sun's Deprecated List. Is it officially deprecated * and if so, what should I use

Are Timers and Loops in .Net accurate?

↘锁芯ラ 提交于 2019-12-17 06:50:40
问题 While developing a program to calculate the frequency and pulse width of the pulse generated by a 555 timer IC, coming to the PC via PC Parallel port. I noticed that every time I run the code it shows different values, so I start testing the Loops and timers for there accuracy. I have run the following code and come to the point that they are inaccurate (I might be wrong, please correct me, if I am!): For Timers: int sec = 0; private void button2_Click(object sender, EventArgs e) { sec =

Timing Delays in VBA

懵懂的女人 提交于 2019-12-17 06:48:09
问题 I would like a 1 second delay in my code. Below is the code I am trying to make this delay. I think it polls the date and time off the operating system and waits until the times match. I am having an issue with the delay. I think it does not poll the time when it matches the wait time and it just sits there and freezes up. It only freezes up about 5% of the time I run the code. I was wondering about Application.Wait and if there is a way to check if the polled time is greater than the wait

Android - loop part of the code every 5 seconds

℡╲_俬逩灬. 提交于 2019-12-17 06:45:50
问题 I would like to start repeating two lines of code every 5 seconds when I press the button START and end it, when I press the button STOP. I was trynig with a TimerTask and Handles, but couldn't figure it out how. public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //final int i; final TextView textView = (TextView) findViewById(R.id.textView); final Button START

Calculating elapsed time in a C program in milliseconds

本秂侑毒 提交于 2019-12-17 06:35:42
问题 I want to calculate the time in milliseconds taken by the execution of some part of my program. I've been looking online, but there's not much info on this topic. Any of you know how to do this? 回答1: Best way to answer is with an example: #include <sys/time.h> #include <stdlib.h> #include <stdio.h> #include <math.h> /* Return 1 if the difference is negative, otherwise 0. */ int timeval_subtract(struct timeval *result, struct timeval *t2, struct timeval *t1) { long int diff = (t2->tv_usec +

Timer in Portable Library

[亡魂溺海] 提交于 2019-12-17 06:35:19
问题 I can't find a timer in portable library / Windows Store. (Targeting .net 4.5 and Windows Store aka Metro) Does any have an idea on how to created some kind of timing event? I need somekind of a stopwatch, so this should refreshn once a second or so 回答1: Update: We have fixed this in Visual Studio 2013. Portable libraries targeting Store (Windows 8.1) and .NET Framework 4.5.1 projects can now reference Timer. This is unfortunate case of where our implementation details are leaking to the user

How do I get my Python program to sleep for 50 milliseconds?

和自甴很熟 提交于 2019-12-17 06:23:11
问题 How do I get my Python program to sleep for 50 milliseconds? 回答1: from time import sleep sleep(0.05) Reference 回答2: Note that if you rely on sleep taking exactly 50 ms, you won't get that. It will just be about it. 回答3: import time time.sleep(50 / 1000) 回答4: can also using pyautogui as import pyautogui pyautogui._autoPause(0.05,1) _autoPause(time1,time2): it Pauses the command for time1*time2 sec time1 refers to how many secs you want time2 refers to repeat how many time both can be floats

iOS perform action after period of inactivity (no user interaction)

好久不见. 提交于 2019-12-17 05:32:18
问题 How can I add a timer to my iOS app that is based on user interaction (or lack thereof)? In other words, if there is no user interaction for 2 minutes, I want to have the app do something, in this case navigate to the initial view controller. If at 1:55 someone touches the screen, the timer resets. I would think this would need to be a global timer so no matter which view you are on, the lack of interaction starts the timer. Although, I could create a unique timer on each view. Does anyone

.NET, event every minute (on the minute). Is a timer the best option?

只愿长相守 提交于 2019-12-17 04:52:23
问题 I want to do stuff every minute on the minute (by the clock) in a windows forms app using c#. I'm just wondering whats the best way to go about it ? I could use a timer and set its interval to 60000, but to get it to run on the minute, I would have to enable it on the minute precisely, not really viable. I could use a timer and set its interval to 1000. Then within its tick event, I could check the clocks current minute against a variable that I set, if the minute has changed then run my code