Forums » Questions and answers »
Getting the current time
Added by kah yong seow over 1 year ago
Hi guys,
I am trying to get the current time using os.clock() but there is a error in IMML console that indicates that the os is a null value. I try to assess it during onLoad method of my root item. Are there other ways to read the current time in VastPark?
Cheers,
Sky
Replies (2)
RE: Getting the current time
-
Added by Craig Presti over 1 year ago
We've disabled some lua tables including the 'os' table.
Instead use the DateTime object, ie:
scene.ui:writeline(datetime.now:tostring())
RE: Getting the current time
-
Added by kah yong seow over 1 year ago
Hi guys,
no problems there. Thanks a lot but I have another problem regarding about date time object. It seems that I am unable to perform any form of arithemetic operation on the two DateTime objects as I assign them to two variables. I need to monitor the user's time spent after logging into the system so I need to keep track of the start time and the current time and to take the difference from there. If there are better ways, pray let me know. Thanks a lot.
Cheers,
Sky.
(1-2/2)