Commit 4efb5208 authored by Jeremy Hylton's avatar Jeremy Hylton

Backport snooze() helper from ZODB4.

parent 024bf384
......@@ -24,6 +24,7 @@ import os
import pickle
import string
import sys
import time
import types
import unittest
from cPickle import Pickler, Unpickler
......@@ -35,6 +36,15 @@ from ZODB.tests.MinPO import MinPO
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):
"""Create a pickle in the format expected by ZODB."""
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