diff --git a/lib.nas b/lib.nas index f47c3f6..dfc1201 100644 --- a/lib.nas +++ b/lib.nas @@ -267,14 +267,6 @@ var assert=func(condition,message="assertion failed!"){ die(message); } -# settimer alows infinite loop running a function with a time interval -var settimer=func(f,interval,realtime=1){ - while(1){ - unix.sleep(interval); - f(); - } -} - # get time stamp, this will return a timestamp object var maketimestamp=func(){ var t=0; diff --git a/main.cpp b/main.cpp index 94a622e..3da19a8 100644 --- a/main.cpp +++ b/main.cpp @@ -107,9 +107,11 @@ void execute(const std::string& file,const uint32_t cmd) } else if(cmd&VM_EXECTIME) { - clock_t t=clock(); + timeb begin,end; + ftime(&begin); vm.run(gen,linker,cmd&VM_OPCALLNUM,cmd&VM_DBGINFO); - std::cout<<"process exited after "<<((double)(clock()-t))/CLOCKS_PER_SEC<<"s.\n"; + ftime(&end); + std::cout<<"process exited after "<<((end.time-begin.time)*1.0+end.millitm/1000.0-begin.millitm/1000.0)<<"s.\n"; } else if(cmd&VM_EXEC) vm.run(gen,linker,cmd&VM_OPCALLNUM,cmd&VM_DBGINFO); diff --git a/stl/fg_env.nas b/stl/fg_env.nas index f838006..29e84f3 100644 --- a/stl/fg_env.nas +++ b/stl/fg_env.nas @@ -22,7 +22,6 @@ var add_event=func(name,interval,function){ timestamp.stamp(); while(timestamp.elapsedMSec()