Skip to main content

Using timers

info

The code examples in this article is only documented with the Python API Client. While many concepts still apply for the JavaScript API, implementation details might differ.

Timers can be used to track how much time has been spend working on something.

To start a timer for a user:

user = # Get a user from ftrack.
task = # Get a task from ftrack.

user.start_timer(task)

A timer has now been created for that user and should show up in the ftrack web UI.

To stop the currently running timer for a user and create a timelog from it:

user = # Get a user from ftrack.
timelog = user.stop_timer()
tip

Starting a timer when a timer is already running will raise in an exception. Use the force parameter to automatically stop the running timer first.

user.start_timer(task, force=True)