Skip to content
This repository was archived by the owner on Apr 12, 2018. It is now read-only.

Commit 4cfa1e7

Browse files
committed
Fix models.history.builder: create better timestamp
1 parent 4f57766 commit 4cfa1e7

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

swf/models/history/builder.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,26 @@
1313
__all__ = ['History']
1414

1515

16+
FIRST_TIMESTAMP = None
17+
LATEST_TIMESTAMP = None
18+
19+
1620
def new_timestamp_string():
1721
from time import time
18-
return '{:.3f}'.format(time())
22+
import random
23+
24+
global FIRST_TIMESTAMP
25+
global LATEST_TIMESTAMP
26+
27+
if FIRST_TIMESTAMP is None:
28+
FIRST_TIMESTAMP = time()
29+
timestamp = FIRST_TIMESTAMP
30+
LATEST_TIMESTAMP = timestamp
31+
else:
32+
LATEST_TIMESTAMP += random.random() * 100
33+
timestamp = LATEST_TIMESTAMP
34+
35+
return timestamp
1936

2037

2138
CHILD_WORKFLOW_STATES = set(

0 commit comments

Comments
 (0)