Linux operatsioonisüsteemis töötab aeg

Allikas: Imre kasutab arvutit
Redaktsioon seisuga 9. juuli 2026, kell 10:41 kasutajalt Imre (arutelu | kaastöö) (Uus lehekülg: '===Sissejuhatus=== TODO CLOCK_MONOTONIC <pre> 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 (nano...')
(erin) ←Vanem redaktsioon | Viimane redaktsiooni (erin) | Uuem redaktsioon→ (erin)
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