Question: new code in java: is the timer always accurate? How to improve accuracy? static void tick(object source, ElapsedEventArgs e) { Console.WriteLine(DateTime.Now.Millisecond.ToString()); //Console.WriteLine(DateTime.Now.ToString(HH:mm:ss.ffff)); } static void
new code in java:
is the timer always accurate? How to improve accuracy?
static void tick(object source, ElapsedEventArgs e) {
Console.WriteLine(DateTime.Now.Millisecond.ToString());
//Console.WriteLine(DateTime.Now.ToString("HH:mm:ss.ffff"));
}
static void Main() {
Console.WriteLine("Press Enter to stop running.");
Console.Write("Enter delay in milliseconds >");
Timer aTimer = new Timer();
aTimer.Interval = Convert.ToDouble(Console.ReadLine());
aTimer.Elapsed += tick;
aTimer.Start();
Console.ReadLine();
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
