Total Pageviews

Monday, April 21, 2014

os.time()

os.time()
ប្រើសំរាប់ត្រឡប់នៅ current time គិតជាវិនាទីចាប់ពី ១៩៧០​ នៅពេលដែលហៅវាដោយគ្មាន arguments ឬក៏ពេលវេលាដែលតំណាងឪ្យថ្ងៃ ហើយនឹងពេលដែលផ្តល់ដោយ given table
Syntax: os.time ( [table])
Table(ជំរើស)វាជាតារាងដែលបំលែងពេលទៅជាវិនាទី, បើសិនជាតារាងមាន វាត្រូវមានឆ្នាំ ខែ ថ្ងៃ ហើយអាចមាន ម៉ោង នាទី នឹង​វិនាទី
សូមមើលកូដះ
local t = os.date( '*t' )  -- get table of current date and time
print( os.time( t ) )      -- print date & time as number of seconds
-- OUTPUT: 1287516614
t.min = t.min + 1          -- add one to the minute field
print( os.time( t ) )      -- print number of seconds (increases by 60 seconds)
-- OUTPUT: 1287516674



No comments:

Post a Comment