Skip to content

Commit

Permalink
Milliseconds added to Timestamp for ndc 14.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Cogswell committed Feb 5, 2025
1 parent 03b989b commit cecdf3b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions NewareNDA/NewareNDAx.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,16 +469,17 @@ def _read_ndc_14_filetype_18(mm):
mm.seek(header)
while mm.tell() < mm_size:
bytes = mm.read(record_len)
for i in struct.iter_unpack('<isffff12siii10s', bytes[132:-59]):
for i in struct.iter_unpack('<isffff12siiih8s', bytes[132:-59]):
Time = i[0]
[Charge_Capacity, Discharge_Capacity] = [i[2], i[3]]
[Charge_Energy, Discharge_Energy] = [i[4], i[5]]
[Timestamp, Step, Index] = [i[7], i[8], i[9]]
Msec = i[10]
if Index != 0:
rec.append([Time/1000,
Charge_Capacity*1000, Discharge_Capacity*1000,
Charge_Energy*1000, Discharge_Energy*1000,
datetime.fromtimestamp(Timestamp, timezone.utc), Step, Index])
datetime.fromtimestamp(Timestamp + Msec/1000, timezone.utc), Step, Index])

# Create DataFrame
df = pd.DataFrame(rec, columns=[
Expand Down

0 comments on commit cecdf3b

Please sign in to comment.