changes time from nanosecond time to seconds since last epoch
This commit is contained in:
parent
87badf3a31
commit
fec97ca7b7
1 changed files with 2 additions and 2 deletions
|
@ -3,8 +3,8 @@ import re
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import time
|
import time
|
||||||
import typing
|
import typing
|
||||||
import math
|
|
||||||
|
|
||||||
|
import math
|
||||||
import nacl.hash
|
import nacl.hash
|
||||||
|
|
||||||
from src.settings import config
|
from src.settings import config
|
||||||
|
@ -100,7 +100,7 @@ def _insert_channel(conn: sqlite3.Connection, channel_name: str, channel_id: str
|
||||||
|
|
||||||
def _insert_comment(conn: sqlite3.Connection, claim_id: str = None, comment: str = None,
|
def _insert_comment(conn: sqlite3.Connection, claim_id: str = None, comment: str = None,
|
||||||
channel_id: str = None, signature: str = None, parent_id: str = None) -> str:
|
channel_id: str = None, signature: str = None, parent_id: str = None) -> str:
|
||||||
timestamp = time.time_ns()
|
timestamp = int(time.time())
|
||||||
comment_prehash = ':'.join((claim_id, comment, str(timestamp),))
|
comment_prehash = ':'.join((claim_id, comment, str(timestamp),))
|
||||||
comment_prehash = bytes(comment_prehash.encode('utf-8'))
|
comment_prehash = bytes(comment_prehash.encode('utf-8'))
|
||||||
comment_id = nacl.hash.sha256(comment_prehash).decode('utf-8')
|
comment_id = nacl.hash.sha256(comment_prehash).decode('utf-8')
|
||||||
|
|
Loading…
Reference in a new issue