Skip to content

Instantly share code, notes, and snippets.

@mikf
Created May 17, 2022 08:42
Show Gist options
  • Save mikf/09f72c6187d4e6f874e548971c385899 to your computer and use it in GitHub Desktop.
Save mikf/09f72c6187d4e6f874e548971c385899 to your computer and use it in GitHub Desktop.
python clock info
#!/usr/bin/env python3
import time
import sys
def get_clock_info():
clock_info = []
for name in ("monotonic", "perf_counter", "process_time",
"thread_time", "time"):
info = time.get_clock_info(name)
clock_info.append(f"""\
{name}:
- adjustable: {info.adjustable}
- implementation: {info.implementation}
- monotonic: {info.monotonic}
- resolution: {info.resolution}
""")
return clock_info
if __name__ == "__main__":
sys.stdout.write("\n".join(get_clock_info()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment