Getting current time in an Activity

The documentation says

Only use Workflow.currentTimeMillis() to get the current time inside a Workflow.

Does it apply only to workflows or activities as well? Can I use System.currentTimeMillis() in activity implementation?

Yes, you can use System.currentTimeMillis() in an activity implementation. Temporal doesn’t impose any restrictions on activity implementations.

1 Like

I guess it applies to all the restrictions mentioned in the Workflow Implementation Constraints

Correct, the restrictions apply only to workflow code.