1秒=1000毫秒
1毫秒=1000微秒
1微秒=1000纳秒
1Tick=100纳秒
1微妙=10Tick
1毫秒=1000微妙=1000*10Tick
1秒=1000毫秒=1000*1000*10Tick
long shanghaiTimeZoneTicks = 8 * 36000000000; var dt = new DateTime(2000, 1, 1); Debug.Log(dt.Ticks); //东8区的ticks区的ticks: 630,822,816,000,000,000 Debug.Log(dt.Ticks - shanghaiTimeZoneTicks); //去掉时区后的ticks: 630,822,528,000,000,000 var dtUtc = dt.ToUniversalTime(); Debug.Log(dtUtc.Ticks); //0时区的ticks: 630,822,528,000,000,000 var dt2 = new DateTime(1, 1, 1, 8, 0, 0); Debug.Log(dt2.Ticks); //东8区的ticks: 288,000,000,000 Debug.Log(dt2.Ticks - shanghaiTimeZoneTicks); //去掉时区后的ticks: 0 dtUtc = dt2.ToUniversalTime(); Debug.Log(dtUtc.Ticks); //0时区的ticks: 0 var dt3 = new DateTime(1970, 1, 1); Debug.Log(dt3.Ticks); //东8区的ticks: 621,355,968,000,000,000 Debug.Log(dt3.Ticks - shanghaiTimeZoneTicks); //去掉时区后的ticks: 621,355,680,000,000,000 dtUtc = dt3.ToUniversalTime(); Debug.Log(dtUtc.Ticks); //0时区的ticks: 621,355,680,000,000,000
java中的System.currentTimeMillis计算
public static long GetCurrentTimeMillis() { long delta = System.DateTime.Now.Ticks - 621355968000000000; long millis = delta / (1000 * 10); //1ms=10,000Tick return millis; }
标签:ticks,Log,c#,Ticks,备忘,000,Debug,1000 From: https://www.cnblogs.com/sailJs/p/18305208