Total Pageviews

Monday, April 21, 2014

OS.Difftime() របស់ Lua

os.difftime()
ប្រើសំរាប់ត្រឡប់នៅចំនួនលេខជា វិនាទីចាប់ពី t1 to time t2 នៅក្នុង POSIX, Windows នឹងប្រព័ន្ធផ្សេងទៀត, តំលៃពិតរបស់វាគឺ t2-t1
Syntax: os.difftime (t1, t2)
T1(តំរូវការ) វាជាចំនួនលេខសំរាប់ parameter ទីមួយ​(in t2-t1)
T2(តំរូវការ) វាជាចំនួនលេខដែលជា second time parameter (in t2-t1)
សូមមើលកូដះ
local t1 = os.time()
-- Print the elapsed time
local function dspTime()
    print( "Time elapsed = " .. os.difftime( os.time(), t1) )
end
timer.performWithDelay( 2000, dspTime )  -- wait second before calling function


No comments:

Post a Comment