Getting system time in gadgets (unsynced)
Moderator: Moderators
Getting system time in gadgets (unsynced)
I need to get the system time in an unsynced gadget. System.time doesnt work so how can i do it?
Re: Getting system time in gadgets (unsynced)
Try os.date(), os.time().
Re: Getting system time in gadgets (unsynced)
Keep in mind that due to the limited precision of Lua numbers, os.time() is rounded to the nearest dozen seconds.
Use Spring.GetTimer() and Spring.DiffTimers(timer,timer) if you need precision.
Use os.date(..) if you need a formatted string showing current time.
Use Spring.GetTimer() and Spring.DiffTimers(timer,timer) if you need precision.
Use os.date(..) if you need a formatted string showing current time.
Re: Getting system time in gadgets (unsynced)
yeah thats what i mean os.time throws errors in gadgets.
Re: Getting system time in gadgets (unsynced)
In synced gadget, that's normal: The clocks of all the computers aren't synced, so os.time is disabled so you don't cause desyncs by using it. In unsynced gadget, I don't know if I ever tried, but that's still not what I meant.
Re: Getting system time in gadgets (unsynced)
unsynced gadget. Yes synced makes sense, but why not unsynced. I dont really want to make this a widget.
Re: Getting system time in gadgets (unsynced)
Either get somebody to add some of the widget calls to unsynced or possibly make a widget do it.
I think the game ID has a timestamp embedded in it, and there might be other functions that can return a timestamp.
I think the game ID has a timestamp embedded in it, and there might be other functions that can return a timestamp.
Re: Getting system time in gadgets (unsynced)
ya i forgot about this. Ill have to check what i did in my music gadget