witten
/
luminotes
Archived
1
0
Fork 0

Okay, just doing the datetime precision hack unconditionally on Windows.

This commit is contained in:
Dan Helfman 2008-08-21 00:43:15 -07:00
parent 0e2e665cca
commit 1c834af8df
1 changed files with 4 additions and 3 deletions

View File

@ -1,3 +1,4 @@
import sys
import time
from datetime import datetime
from pytz import utc
@ -74,9 +75,9 @@ class Persistent( object ):
def update_revision( self ):
revision = datetime.now( tz = utc )
# if the revision didn't change, then we must be using a low-precision timer on a platform like
# Windows. so, replace the microseconds with a value from a higher-precision timer
if revision == self.__revision:
# as a work around for the low-precision timer on Windows, replace the microseconds with a value
# from a higher-precision timer
if sys.platform.startswith( "win" ):
MICROSECONDS = 1000000
revision = revision.replace( microsecond = int( time.clock() * MICROSECONDS ) % MICROSECONDS )