#-=====================-#
# 计时器清零
#-=====================-#
def clear()
if @perf_flag
@qpCounter.call(@time_start)
else
@time_start=[@tGetTime.call(),0].pack('LL')
end
end
#-==============================-#
# 帧错...
#-==============================-#
def debug(now_time)
if @decimal>0
now_time = (now_time * (10**@decimal)).floor/(10.0**@decimal)
else
now_time = now_time.floor
end
return now_time
#以下用于debug模式
if now_time < 0
p "Timer Wrong!! Clear...",now_time, @perf_flag,@qpCounter,@tGetTime,
@time_now.unpack('LL')[0],@time_now.unpack('LL')[1],
@time_start.unpack('LL')[0],@time_start.unpack('LL')[1]
self.clear()
return 0.0
else
return now_time
end
end
#-=====================-#
# 获取时间比例因数
#-=====================-#
def scale()
return @time_scale[0]+ @time_scale[1]*0xffffffff
end
#-=====================-#
# 获取起始滴答数
#-=====================-#
def start()
return @time_start.unpack('LL')[0]+ @time_start.unpack('LL')[1]*0xffffffff
end
#-=====================-#
# 获取当前的嘀哒数
#-=====================-#
def timer()
if @perf_flag
@qpCounter.call(@time_now)
else
@time_now=[@tGetTime.call(),0].pack('LL')
end
return @time_now.unpack('LL')[0]+ @time_now.unpack('LL')[1]*0xffffffff
end
end