From d72adb41eca58994d11331d2659e6a061af668d8 Mon Sep 17 00:00:00 2001
From: Bruce Flynn <brucef@ssec.wisc.edu>
Date: Thu, 22 Feb 2018 15:42:35 -0600
Subject: [PATCH] potential fix for seek_to

---
 edosl0util/stream.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/edosl0util/stream.py b/edosl0util/stream.py
index 6111beb..0311c90 100644
--- a/edosl0util/stream.py
+++ b/edosl0util/stream.py
@@ -13,6 +13,7 @@ from edosl0util.headers import (
 )
 
 from edosl0util import headers
+from edosl0util.timecode import dt_to_cds
 
 LOG = logging.getLogger(__name__)
 
@@ -262,6 +263,7 @@ class PacketStream(object):
         Seek forward such that the next packet provided will be the first packet
         having a timestamp available in the secondary header >= stamp and apid.
         """
+        target_tc = dt_to_cds(stamp)
         # seek past partial groups
         packet = self.next()
         while not packet.cds_timecode:
@@ -269,7 +271,7 @@ class PacketStream(object):
 
         # seek to first packet => `stamp`
         current_tc = packet.cds_timecode
-        while current_tc < stamp:
+        while current_tc < target_tc:
             packet = self.next()
             current_tc = packet.cds_timecode or current_tc
 
-- 
GitLab