From ff6f5290c1df7bcaf699c1d0a8283f4694f1760b Mon Sep 17 00:00:00 2001
From: kienle <kienle@passcal.nmt.edu>
Date: Thu, 20 Jul 2023 15:23:22 -0600
Subject: [PATCH] Fix time precision issue

Fix time precision issue by getting nanosecond directly from stored
UTCDateTime instead of UTC timestamp
---
 sohstationviewer/model/reftek/rt130_experiment/reftek.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sohstationviewer/model/reftek/rt130_experiment/reftek.py b/sohstationviewer/model/reftek/rt130_experiment/reftek.py
index 4b1c452f3..5de77e643 100644
--- a/sohstationviewer/model/reftek/rt130_experiment/reftek.py
+++ b/sohstationviewer/model/reftek/rt130_experiment/reftek.py
@@ -160,8 +160,7 @@ def convert_packet_to_obspy_format(packet: Union[EHETPacket, DTPacket], unpacker
     # Obspy only stores the last two digits of the year.
     converted_packet['year'] = packet.header.time.year % 100
     converted_packet['unit_id'] = packet.header.unit_id
-    # We need to convert the stored time from second to nanosecond
-    converted_packet['time'] = packet.header.time.timestamp * 10**9
+    converted_packet['time'] = packet.header.time.ns
     converted_packet['byte_count'] = packet.header.byte_count
     converted_packet['packet_sequence'] = packet.header.packet_sequence
     converted_packet['event_number'] = packet.extended_header.event_number
-- 
GitLab