Commit 12472727 authored by Jeremy Hylton's avatar Jeremy Hylton

Backport snooze() helper from ZODB4.

parent ee956873
...@@ -24,6 +24,7 @@ import os ...@@ -24,6 +24,7 @@ import os
import pickle import pickle
import string import string
import sys import sys
import time
import types import types
import unittest import unittest
from cPickle import Pickler, Unpickler from cPickle import Pickler, Unpickler
...@@ -35,6 +36,15 @@ from ZODB.tests.MinPO import MinPO ...@@ -35,6 +36,15 @@ from ZODB.tests.MinPO import MinPO
ZERO = '\0'*8 ZERO = '\0'*8
def snooze():
# In Windows, it's possible that two successive time.time() calls return
# the same value. Tim guarantees that time never runs backwards. You
# usually want to call this before you pack a storage, or must make other
# guarantees about increasing timestamps.
now = time.time()
while now == time.time():
time.sleep(0.1)
def zodb_pickle(obj): def zodb_pickle(obj):
"""Create a pickle in the format expected by ZODB.""" """Create a pickle in the format expected by ZODB."""
f = StringIO() f = StringIO()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment