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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!