Linux operatsioonisüsteemis töötab aeg
Allikas: Imre kasutab arvutit
Mine navigeerimisribaleMine otsikasti
Sissejuhatus
TODO
CLOCK_MONOTONIC
root@ubuntu-2604-01:~# cat clock_monotonic.py
#!/usr/bin/python3
import time
def main():
# Retrieve the current value of the monotonic clock (in seconds)
monotonic_time = time.monotonic()
print(f"Current clock_monotonic value (seconds): {monotonic_time}")
# If you need nanosecond precision, you can use time.monotonic_ns()
monotonic_ns = time.monotonic_ns()
print(f"Current clock_monotonic value (nanoseconds): {monotonic_ns}")
if __name__ == "__main__":
main()
root@ubuntu-2604-01:~# ./clock_monotonic.py
Current clock_monotonic value (seconds): 2423313.122769894
Current clock_monotonic value (nanoseconds): 2423313122804008