add ghost type timestamp

This commit is contained in:
ValKmjolnir
2023-11-27 20:25:02 +08:00
parent 2bb9655422
commit 8c3c8d3d62
8 changed files with 98 additions and 21 deletions

View File

@@ -6,8 +6,8 @@ use std.coroutine;
println("-------------------------------------------------------------");
println(" FlightGear simulated-env for developers project, since 2019");
println(" Developed by:");
println(" Sidi Liang (FGPRC-0762)");
println(" Haokun Lee (FGPRC-0818 aka ValKmjolnir)");
println(" Sidi762 (FGPRC-0762)");
println(" ValKmjolnir (FGPRC-0818)");
println("-------------------------------------------------------------");
println(" See help using command line argument: --fg-env-help");
println("-------------------------------------------------------------");

View File

@@ -7,7 +7,6 @@ var SEEK_CUR = io.SEEK_CUR;
var SEEK_END = io.SEEK_END;
var new = func(filename, mode="r") {
if (!io.exists(filename)) {
return nil;

View File

@@ -327,11 +327,20 @@ var assert = func(condition, message = "assertion failed!") {
# get time stamp, this will return a timestamp object
var maketimestamp = func() {
var t = 0;
var stamp = __maketimestamp();
var time_stamp = func(stamp) {
return __time_stamp(stamp);
}
var elapsed_millisecond = func(stamp) {
return __elapsed_millisecond(stamp);
}
var elapsed_microsecond = func(stamp) {
return __elapsed_microsecond(stamp);
}
return {
stamp: func() {t = __millisec();},
elapsedMSec: func() {return __millisec()-t;},
elapsedUSec: func() {return (__millisec()-t)*1000;}
stamp: func() {return time_stamp(stamp);},
elapsedMSec: func() {return elapsed_millisecond(stamp);},
elapsedUSec: func() {return elapsed_microsecond(stamp);}
};
}