Time stamps for time since last activated

Posted on
Wed Jul 24, 2013 6:34 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Time stamps for time since last activated

Dewster35 wrote:
Do apple scripts not run in their own process? I usually try to run them not embedded whenever I am running any sort of script.

• Linked AppleScripts run in their own process which is a bit slower to start because the new process has to be loaded and executed.
• Linked Python scripts run in their own process which is also slower to start.
• Embedded AppleScripts run in the main Indigo Server thread and can block the server if they hang up or have delays. Not recommended except for very simple scripts that only target the Indigo Server (not other apps).
• Embedded Python scripts run in a separate process (from Indigo Server) but they all share the same process. Startup time is only slower for the first script that is executed, then the rest are very fast because the process is already running. As long as a script doesn't take more than 10 seconds to executed, embedded is recommend for python.

Image

Posted on
Wed Jul 24, 2013 7:03 pm
Dewster35 offline
Posts: 1030
Joined: Jul 06, 2010
Location: Petoskey, MI

Re: Time stamps for time since last activated

Is there a way to find out how long a script is taking to be executed in python?

Posted on
Sun Jul 28, 2013 2:03 pm
rhanson offline
Posts: 192
Joined: Apr 30, 2013

Re: Time stamps for time since last activated

Via brute force is simple enough. That is, record the time at the top and bottom of your script.

Code: Select all
# at beginning
startTime = datetime.now()

...

# at bottom of script
endTime = datetime.now()
delta = endTime - startTime
indigo.server.log("Elapsed time: " + str(delta))


... or use the formatting you've already figured out :-)

Posted on
Thu Aug 12, 2021 1:20 pm
Bildhauer offline
Posts: 160
Joined: Sep 30, 2019
Location: 22113 Oststeinbek (near Hamburg), Germany

Re: Time stamps for time since last activated

Maybe someone can help me here:

    1. Whats the best way to save a timestamp to variable?
    2. I want to compare a stored timestamp with a new one and need the difference in days. How can I manage it?

´Thanks in advance!

Bildhauer1963

Who is online

Users browsing this forum: No registered users and 10 guests