1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-10 00:34:40 +00:00
Funkin/source/Postbuild.hx

38 lines
774 B
Haxe
Raw Normal View History

package source; // Yeah, I know...
import sys.FileSystem;
import sys.io.File;
class Postbuild
{
static inline final buildTimeFile = '.build_time';
static function main()
{
printBuildTime();
}
static function printBuildTime()
{
// get buildEnd before fs operations since they are blocking
var end:Float = Sys.time();
if (FileSystem.exists(buildTimeFile))
{
var fi = File.read(buildTimeFile);
var start:Float = fi.readDouble();
fi.close();
sys.FileSystem.deleteFile(buildTimeFile);
var buildTime = roundToTwoDecimals(end - start);
trace('Build took: ${buildTime} seconds');
}
}
private static function roundToTwoDecimals(value:Float):Float
{
return Math.round(value * 100) / 100;
}
}