Best way to capture short spans in a Duration? #878
Unanswered
Evan0000000000
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
i was to measure execution time with perfcounter and convert that to a Duration to take advantage of the attributes in formatting a logging message.
It seems like to do this one has to do roughly:
This seems a little convoluted, but conversely using
Datetime.now()
doesn't capture any time elapsed for relatively fast intervals, so I'm not sure of a better way to achieve this.Edit-
For context this is for wrapping around some data processing functionality, so a large dataset may conceivably take a few hours but a test case or a small dataset may take virtually no time, hence the interest in easy access to the Duration's hour minute and second attributes while also capturing small spans of time as well.
Beta Was this translation helpful? Give feedback.
All reactions