| 1 | # -*- coding: utf-8 -*- |
| 2 | # |
| 3 | # Copyright (C) 2020 - Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> |
| 4 | # |
| 5 | # This library is free software; you can redistribute it and/or modify it under |
| 6 | # the terms of the GNU Lesser General Public License as published by the Free |
| 7 | # Software Foundation; version 2.1 of the License. |
| 8 | # |
| 9 | # This library is distributed in the hope that it will be useful, but WITHOUT |
| 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 11 | # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
| 12 | # details. |
| 13 | # |
| 14 | # You should have received a copy of the GNU Lesser General Public License |
| 15 | # along with this library; if not, write to the Free Software Foundation, Inc., |
| 16 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 17 | |
| 18 | import sys |
| 19 | import time |
| 20 | |
| 21 | |
| 22 | # Support for deprecation of time.clock(). |
| 23 | # Deprecated since python 3.3 and removed in python 3.8. |
| 24 | # See PEP 418 for more details. |
| 25 | def _clock(): |
| 26 | if sys.version_info > (3,2): |
| 27 | clock = time.perf_counter() |
| 28 | else: |
| 29 | clock = time.clock() |
| 30 | return clock |