File size: 410 Bytes
d1ceb73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 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()