I am writing a package that automatically collects program execution metadata including the time program execution began and terminated.
The Python standard library exposes a hook to have code run automatically at interpreter termination via atexit.register
. Using this to record a termination time is sufficient for my needs.
Since this approach will record, approximately, the time interpreter execution terminates, I would like the corresponding begin time to be approximately the time interpreter execution begins.
Is it possible to determine this time within a Python module?