fix date formatting
This commit is contained in:
parent
57c04685a1
commit
c0dfb9b628
@ -1,4 +1,5 @@
|
|||||||
import ntp.packet
|
import ntp.packet
|
||||||
|
import ntp.ntpc
|
||||||
import threading
|
import threading
|
||||||
from contextlib import AbstractContextManager
|
from contextlib import AbstractContextManager
|
||||||
import time
|
import time
|
||||||
@ -40,14 +41,7 @@ def pass_value(x):
|
|||||||
return x
|
return x
|
||||||
|
|
||||||
def string_ntp_seconds(x):
|
def string_ntp_seconds(x):
|
||||||
h1, h2 = x.split('.')
|
return ntp.ntpc.prettydate(x).split(' ')[1]
|
||||||
seconds = int(h1, 16)
|
|
||||||
fraction = int(h2, 16)
|
|
||||||
ntp_epoch = datetime.datetime(1900, 1, 1)
|
|
||||||
timestamp = ntp_epoch + datetime.timedelta(seconds=seconds)
|
|
||||||
microseconds = fraction // 1000
|
|
||||||
timestamp = timestamp.replace(microsecond=microseconds)
|
|
||||||
return f"{timestamp} UTC"
|
|
||||||
|
|
||||||
|
|
||||||
SYSINFO_KEYS = [
|
SYSINFO_KEYS = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user