How to get run time

I used Clockwork TimeSpan.LapTime, but I want to know if there is another way because TimeSpan.LapTime causes an error and cannot be executed. There is no problem with python.

DynamoVersion 2.3.0

You could also do this way in python:

# Import Time
import time

# Start Run-time
start = time.time()

# Do Something

# Calculate Run-time
time = ("%s s" % (time.time()-start))

### Get run time ###
OUT = time

How do I fill out the form to connect a Dynamo node to a python node?
Because I’m learning Python so I’m a beginner…

Hmm, sure it is set up right?
Seems to be working on my end.


By the way, the error is this.
Normally, it can be used without problems, but it is displayed when the node of TimeSpan.LapTime is placed and executed.

Starting with Dynamo 2.5 you can leverage the TuneUp view extension, which is quite handy for this. May be worth upgrading a detached version of your model and doing your time optimization there.


Is there a TuneUp alternative for Dynamo 2.3?

TimeSpan.LapTime etc. do not appear in my Clockwork for Dynamo.image

Anything to do with this error?image

Clockwork 2.3.0 is installed.

Try uninstalling bakery.


That was a rabbit hole of connected Packages. Never mind.

Python to return current time in Dynamo:
import time
dataEnteringNode = IN
myTime = time.strftime(’{%Y-%m-%d %H:%M:%S}’)
OUT = myTime

I tried that but result is always 0.0 s, why?

Likely because you aren’t doing anything in the # Do Something section of the code, and as a result are just asking for the difference in time between now and now(so 0.0 seconds).

The TuneUp view extension is likely a better place to go now, as it will quarry the full run time for any node.