From 220c54ba7de60379ab31d702ef6602477210f3e7 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 1 Jul 2019 14:10:17 +0100 Subject: [PATCH] Microsecond accurate status numbers --- posts.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/posts.py b/posts.py index 17c055930..a46e8720c 100644 --- a/posts.py +++ b/posts.py @@ -239,7 +239,7 @@ def getStatusNumber() -> (str,str): currTime=datetime.datetime.utcnow() daysSinceEpoch=(currTime - datetime.datetime(1970,1,1)).days # status is the number of seconds since epoch - statusNumber=str((daysSinceEpoch*24*60*60) + (currTime.hour*60*60) + (currTime.minute*60) + currTime.second) + statusNumber=str(((daysSinceEpoch*24*60*60) + (currTime.hour*60*60) + (currTime.minute*60) + currTime.second)*1000000 + currTime.microsecond) published=currTime.strftime("%Y-%m-%dT%H:%M:%SZ") conversationDate=currTime.strftime("%Y-%m-%d") return statusNumber,published @@ -310,6 +310,8 @@ def createPostBase(baseDir: str,username: str, domain: str, port: int,toUrl: str newPost['cc']=ccUrl newPost['object']['cc']=ccUrl if saveToFile: + if ':' in domain: + domain=domain.split(':')[0] outboxDir = createOutboxDir(username,domain,baseDir) filename=outboxDir+'/'+newPostId.replace('/','#')+'.json' with open(filename, 'w') as fp: