mirror of
https://github.com/aykhans/AzSuicideDataVisualization.git
synced 2025-04-22 10:28:02 +00:00
32 lines
576 B
Python
32 lines
576 B
Python
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
# Licensed under the MIT License. See LICENSE in the project root
|
|
# for license information.
|
|
|
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
|
|
|
"""Provides monotonic timestamps with a resetable zero.
|
|
"""
|
|
|
|
import sys
|
|
import time
|
|
|
|
__all__ = ["current", "reset"]
|
|
|
|
|
|
if sys.version_info >= (3, 5):
|
|
clock = time.monotonic
|
|
else:
|
|
clock = time.clock
|
|
|
|
|
|
def current():
|
|
return clock() - timestamp_zero
|
|
|
|
|
|
def reset():
|
|
global timestamp_zero
|
|
timestamp_zero = clock()
|
|
|
|
|
|
reset()
|