浏览代码

php : Date.now() now uses the more accurate microtime function (patch from Ярослав Сиваков)

Franco Ponticelli 14 年之前
父节点
当前提交
cf7706b1b9
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      std/php/_std/Date.hx

+ 3 - 3
std/php/_std/Date.hx

@@ -32,7 +32,7 @@
 	}
 
 	public function getTime() : Float {
-		return __t*1000;
+		return __t * 1000;
 	}
 
 	private function getPhpTime() : Float {
@@ -73,7 +73,7 @@
 	}
 
 	public static function now() : Date {
-		return fromPhpTime(untyped __call__("time"));
+		return fromPhpTime(untyped __call__("round", __call__("microtime", true), 3));
 	}
 
 	static function fromPhpTime( t : Float ) : Date {
@@ -84,7 +84,7 @@
 
 	public static function fromTime( t : Float ) : Date {
 		var d = new Date(2000,1,1,0,0,0);
-		d.__t = t/1000;
+		d.__t = t / 1000;
 		return d;
 	}