private void Time(int i)
         {
            Stopwatch sw = new Stopwatch();
            sw.Start();
            Thread.Sleep(i);
            sw.Stop();
            Console.WriteLine(sw.ElapsedTicks / (decimal)Stopwatch.Frequency * 1000);
         }
   

 在main函数中调用Time(1000); 定时1000ms,

 控制台显示实际运行时间:999.9807566979519995073714676

相关文章:

  • 2021-09-16
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2021-08-27
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-15
  • 2022-12-23
  • 2021-09-15
  • 2021-07-24
  • 2022-12-23
相关资源
相似解决方案