You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
410 B
Python
23 lines
410 B
Python
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
# Licensed under the MIT License. See LICENSE in the project root
|
|
# for license information.
|
|
|
|
"""Provides monotonic timestamps with a resetable zero.
|
|
"""
|
|
|
|
import time
|
|
|
|
__all__ = ["current", "reset"]
|
|
|
|
|
|
def current():
|
|
return time.monotonic() - timestamp_zero
|
|
|
|
|
|
def reset():
|
|
global timestamp_zero
|
|
timestamp_zero = time.monotonic()
|
|
|
|
|
|
reset()
|