summaryrefslogtreecommitdiff
path: root/lib/Crypto/Util
diff options
context:
space:
mode:
authorDwayne Litzenberger <dlitz@dlitz.net>2013-04-21 23:24:23 -0700
committerDwayne Litzenberger <dlitz@dlitz.net>2013-04-21 23:24:23 -0700
commit22d7760ae7346d80a6c54b1549e9a1d560c239bc (patch)
tree91989962330105d327d8fade2cc9a5d6c8864f72 /lib/Crypto/Util
parentcce74edc6c792efbe402eca681a7cead4836f543 (diff)
downloadpycrypto-22d7760ae7346d80a6c54b1549e9a1d560c239bc.tar.gz
FortunaAccumulator: Use time.monotonic if available (i.e. Python 3.3 and later)
Diffstat (limited to 'lib/Crypto/Util')
-rw-r--r--lib/Crypto/Util/_time.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/Crypto/Util/_time.py b/lib/Crypto/Util/_time.py
new file mode 100644
index 0000000..ff4c6a9
--- /dev/null
+++ b/lib/Crypto/Util/_time.py
@@ -0,0 +1,28 @@
+# -*- coding: ascii -*-
+#
+# _time.py : Internal monotonic time module.
+#
+# Written in 2013 by Dwayne C. Litzenberger <dlitz@dlitz.net>
+#
+# ===================================================================
+# The contents of this file are dedicated to the public domain. To
+# the extent that dedication to the public domain is not available,
+# everyone is granted a worldwide, perpetual, royalty-free,
+# non-exclusive license to exercise all rights associated with the
+# contents of this file for any purpose whatsoever.
+# No rights are reserved.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+# ===================================================================
+
+try:
+ from time import monotonic as maybe_monotonic_time
+except ImportError:
+ from time import time as maybe_monotonic_time