فهرست منبع

[cs] don't instantiate Date for Sys.time, use DateTime directly, also return utc timestamp (see #4584)

Dan Korostelev 9 سال پیش
والد
کامیت
e8713a48c5
1فایلهای تغییر یافته به همراه2 افزوده شده و 1 حذف شده
  1. 2 1
      std/cs/_std/Sys.hx

+ 2 - 1
std/cs/_std/Sys.hx

@@ -127,9 +127,10 @@ class Sys {
 		Environment.Exit(code);
 		Environment.Exit(code);
 	}
 	}
 
 
+	@:readOnly static var epochTicks = new cs.system.DateTime(1970, 1, 1).Ticks;
 	public static function time() : Float
 	public static function time() : Float
 	{
 	{
-		return Date.now().getTime() / 1000;
+		return cast((cs.system.DateTime.UtcNow.Ticks - epochTicks), Float) / cast(cs.system.TimeSpan.TicksPerSecond, Float);
 	}
 	}
 
 
 	public static inline function cpuTime() : Float
 	public static inline function cpuTime() : Float