mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-05 22:34:36 +00:00
0a19c7a8cb
* hx the codec * fix(ci,html5): use haxe.Timer instead of Sys.time * refactor(compat): use haxe.Timer instead of Sys.time(), introduce TimerUtil to reduce code dupe * fix: redundant types * refactor(style): use TimerTools in place of haxe.Timer * refactor: consistent timer code * feat: build timings * refactor(ci): cleanup ci configs * sigh * sigh, 2 * fix: haxelib deleterepo does not silently fail * retrigger ci * verbose output * debug info after haxelib gti * force haxelib git override * more debug info * force bash * at least haxelib is consistent now * fix the runners first, then do that * update ci-haxe * it is time? * deleterepo may fail * finishing touches
31 lines
679 B
Haxe
31 lines
679 B
Haxe
package funkin.util.tools;
|
|
|
|
import funkin.util.tools.FloatTools;
|
|
import haxe.Timer;
|
|
|
|
class TimerTools
|
|
{
|
|
public static function start():Float
|
|
{
|
|
return Timer.stamp();
|
|
}
|
|
|
|
private static function took(start:Float, ?end:Float):Float
|
|
{
|
|
var endOrNow:Float = end != null ? end : Timer.stamp();
|
|
return endOrNow - start;
|
|
}
|
|
|
|
public static function seconds(start:Float, ?end:Float, ?precision = 2):String
|
|
{
|
|
var seconds:Float = FloatTools.round(took(start, end), precision);
|
|
return '${seconds} seconds';
|
|
}
|
|
|
|
public static function ms(start:Float, ?end:Float):String
|
|
{
|
|
var seconds:Float = took(start, end);
|
|
return '${seconds * 1000} ms';
|
|
}
|
|
}
|