Skip to content

Commit

Permalink
Add UTC human readable timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
krlawrence committed Jun 20, 2022
1 parent 59eba4b commit 9099e6c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/graph_notebook/magics/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import ipywidgets as widgets
import queue
from datetime import datetime
from IPython.display import display, HTML
from graph_notebook.neptune.client import STREAM_AT, STREAM_AFTER, STREAM_TRIM, STREAM_EXCEPTION_NOT_FOUND,\
STREAM_EXCEPTION_NOT_ENABLED, STREAM_PG, STREAM_RDF, STREAM_ENDPOINTS,\
Expand Down Expand Up @@ -189,6 +190,7 @@ def show_records(self, records):
timestamp = None
if STREAM_COMMIT_TIMESTAMP in record:
timestamp = record[STREAM_COMMIT_TIMESTAMP]
utc_text = datetime.utcfromtimestamp(timestamp/1000)

data = json.dumps(record['data']).replace('&', '&amp;').replace('<', '&lt;')

Expand All @@ -198,7 +200,7 @@ def show_records(self, records):
html += '<td style="border: 1px solid black; vertical-align: top; text-align: left;" colspan="3">{}'.format(commit_num)
if timestamp != None:
html += '&nbsp;&nbsp;&nbsp;Timestamp = {}'.format(timestamp)

html += '&nbsp;&nbsp;&nbsp;{} UTC'.format(utc_text)
html += '</td>'
html += '</tr><tr style="border: 1px solid black;">'

Expand Down

0 comments on commit 9099e6c

Please sign in to comment.