From f21b4101548da5cbd0350d2654e1d4213957ff1f Mon Sep 17 00:00:00 2001 From: Tommi Virtanen Date: Tue, 26 Jul 2011 09:41:48 -0700 Subject: [PATCH] Use a constant for nanoseconds-in-a-second. State it in terms of 1e9 (as int not float). My eyes get blurry from that many zeros. --- s3tests/realistic.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/s3tests/realistic.py b/s3tests/realistic.py index 3251136..2da8374 100644 --- a/s3tests/realistic.py +++ b/s3tests/realistic.py @@ -5,6 +5,10 @@ import string import struct import time + +NANOSECOND = int(1e9) + + class RandomContentFile(object): def __init__(self, size, seed): self.size = size @@ -19,7 +23,7 @@ class RandomContentFile(object): self.seek(0) def _mark_chunk(self): - self.chunks.append([self.offset, (time.time() - self.last_seek) * 1000000000]) + self.chunks.append([self.offset, (time.time() - self.last_seek) * NANOSECOND]) def seek(self, offset): assert offset == 0 @@ -89,7 +93,7 @@ class FileVerifier(object): self.chunks = [] def _mark_chunk(self): - self.chunks.append([self.size, (time.time() - self.created_at) * 1000000000]) + self.chunks.append([self.size, (time.time() - self.created_at) * NANOSECOND]) def write(self, data): self.size += len(data)