参考:http://www.cnblogs.com/delphinet/archive/2011/06/09/2075985.html
转换成秒:
using System; using System.Collections.Generic; class Sentence { static void Main() { long ticks0 = DateTime.Now.Ticks; for (int i = 0; i < int.MaxValue; i++) { // ... } long ticks1 = DateTime.Now.Ticks; double n = (ticks1 - ticks0) / 10000000.0; Console.WriteLine("上面这段程序运行了{0}秒", n); } }
时间: 2024-10-06 15:30:32