Display current time

About advanced scenes, and the Thyme scripting language used in Algodoo.

Display current time

Postby eeieeio » Mon Mar 19, 2018 11:02 pm

Hello

Is there a way to display the current time (local computer time) in a scene?

Dave
eeieeio
eeieeio
 
Posts: 25
Joined: Thu Nov 30, 2017 7:02 pm

Re: Display current time

Postby Xray » Sat Mar 24, 2018 11:38 pm

Edited August 04, 2023 - The following post was all determined by my own testing and experimentation. So, the information may not be completely accurate but it is to the best of my knowledge. If anyone reading this believes that something I stated is not accurate, please post a reply explaining the error(s).

There are three types of time keepers (as far as I know) that can be used in scripts as timers. One is sim.time, another is sim.tick, and the third one is system.time.
Both sim.time and sim.tick start and stop each time your scene is in RUN or PAUSE status, and they both begin at 0.0 each time you load a scene into Algodoo. All three timers are "read only". That means you cannot set them to a random value nor reset them to zero (except as noted elsewhere in this post). System.time runs constantly regardless of the scene RUN/PAUSE status, and it begins at 0.0 each time you launch Algodoo regardless if you have a scene loaded or not. Sim.time counts the number of simulation seconds (including fractions of a second). Sim.tick is based on the sim.frequency value. For example, if the sim.frequency is set to 60, then there will be 60 sim.ticks per each simulated second. If the sim.frequency is set to 120, then there will be 120 sim.ticks per each simulated second. Sim.time is not an accurate timer because it can slow down and speed up depending on whether the scene is slowing down or speeding up (which can vary due to the setting of the simulation speed slider, or by computer lag). System.time is not affected by the scene nor by computer lag because it is generated by the computer hardware. The timers only provide timing "ticks" in seconds and fractions of a second which can be used to trigger a clock, for example. They cannot be used by themselves to give you actual hours, minutes, and seconds. That would be up to YOU to do the required calculations and format the digit displays that are needed in order to show hours, minutes, and seconds.
User avatar
Xray
 
Posts: 500
Joined: Sun Jun 17, 2012 6:12 am
Location: USA


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 2 guests

cron