diff --git a/edosl0util/crgen.py b/edosl0util/crgen.py
index c6ccb4722b1c4818e57bddfbe19c54d80fe75627..ccb606eb0ebffdb9e6aadff6050701cbf6b50a4c 100644
--- a/edosl0util/crgen.py
+++ b/edosl0util/crgen.py
@@ -11,6 +11,7 @@ import pprint
 import edosl0util.crio as crio
 from edosl0util.headers import DaySegmentedTimecode
 from edosl0util.stream import jpss_packet_stream
+from edosl0util.timecode import dt_to_cds
 
 
 def diff_crs(real_file, generated_file):
@@ -115,7 +116,7 @@ def pds_id_from_path(pds_file):
 def get_pds_creation_time(pds_file_or_id):
     """Parse 11-char creation time out of a PDS ID or file name; return a DaySegmentedTimecode"""
     pds_file_or_id = os.path.basename(pds_file_or_id)
-    return create_timecode(datetime.strptime(pds_file_or_id[22:33], '%y%j%H%M%S'))
+    return create_timecode(dt_to_cds(datetime.strptime(pds_file_or_id[22:33], '%y%j%H%M%S')))
 
 
 def build_apid_info(scan_apid_info):
@@ -189,7 +190,7 @@ def scan_packets(pds_file, prev_pds_file=None):
             if pkt.cds_timecode:
                 if not first_pkt_time:
                     first_pkt_time = pkt.cds_timecode
-                last_pkt_time = pkt.cds_timemcode
+                last_pkt_time = pkt.cds_timecode
         return {'first_packet_time': create_timecode(first_pkt_time),
                 'last_packet_time': create_timecode(last_pkt_time),
                 'apid_info': [apid_map[k] for k in sorted(apid_map)]}
@@ -241,7 +242,7 @@ def create_timecode(tc):
 
     Handles input of None by returning epoch value of 1958-01-01.
     """
-    return DaySegmentedTimecode(tc.days, tc.millis, tc.micros) if tc else DaySegmentedTimecode()
+    return DaySegmentedTimecode(*tc) if tc else DaySegmentedTimecode()
 
 
 idps_epoch = datetime(1958, 1, 1)
diff --git a/edosl0util/merge.py b/edosl0util/merge.py
index 64c951de9486d64252770857819cd8ec949be71a..d73b9e1b3a29a9a5024dacb0172daa95cf065486 100644
--- a/edosl0util/merge.py
+++ b/edosl0util/merge.py
@@ -95,11 +95,14 @@ def read_packet_index(stream):
 
 
 def _sort_by_time_apid(index, order=None):
+    """
+    Sort pointers by time and apid in-place.
+    """
     if order:
         index = sorted(index, key=lambda p: order.index(p.apid) if p.apid in order else -1)
     else:
         index = sorted(index, key=lambda p: p.apid)
-    return sorted(index, key=lambda p: p.cds_timecode)
+    return sorted(index, key=lambda p: p.timecode)
 
 
 def _filter_duplicates_by_size(index):
diff --git a/edosl0util/stream.py b/edosl0util/stream.py
index b6edc98e52a2d16efc8f91917a19b8a7e6ad367c..6111beb01bcdfaf4c412085463ba5b6112c5e9e0 100644
--- a/edosl0util/stream.py
+++ b/edosl0util/stream.py
@@ -124,7 +124,7 @@ class Packet(object):
         return (
             self.secondary_header and
             hasattr(self.secondary_header, 'timecode') and
-            self.secondary_header.day_segmented_timecode() or None)
+            self.secondary_header.timecode.day_segmented_timecode() or None)
 
     @property
     def stamp(self):
diff --git a/edosl0util/timecode.py b/edosl0util/timecode.py
index cf1c35781b86637ea2741a5ef4ff5dc3abccf5fd..37f2a7507421ec518b321c9498b6dab1094696f2 100644
--- a/edosl0util/timecode.py
+++ b/edosl0util/timecode.py
@@ -48,4 +48,12 @@ def cds_to_dt(days, ms, us):
     return timecode_parts_to_dt(days, ms, us, CDS_EPOCH)
 
 
+def dt_to_cds(dt):
+    """
+    UTC datetime to (day, millis, micros)
+    """
+    d = (dt - CDS_EPOCH)
+    return (d.days, int(d.seconds * 1e3), d.microseconds)
+
+
 iet_to_dt = _grain.iet2utc