mbakholdina / lib-tcpdump-processing

Library designed to process .pcap(ng) tcpdump or Wireshark trace files and extract SRT packets of interest for further analysis
15 stars 3 forks source link

CEST/CST Datetime parsing issue #22

Closed maxsharabayko closed 1 year ago

maxsharabayko commented 4 years ago

The following values in the frame.time column of the CSV file from tshark fail to parse with the library Apr 01, 2020 16:29:53.150479 CST Apr 01, 2020 16:29:53.150479 CEST

Replacing with this one works: Apr 01, 2020 16:29:53.150479 CET

Environment

Error message

  File "/Users/maxsharabayko/projects/srt/lib-tcpdump-processing/scripts/get_traffic_stats.py", line 35, in main
    srt_packets = extract_packets.extract_srt_packets(csv_filepath)
  File "/Users/maxsharabayko/projects/srt/lib-tcpdump-processing/tcpdump_processing/extract_packets.py", line 145, in extract_srt_packets
    srt_packets['frame.time'] = pd.to_datetime(srt_packets['frame.time'], format='%b %d, %Y %H:%M:%S.%f %Z')
  File "/Users/maxsharabayko/projects/srt/lib-tcpdump-processing/venv/lib/python3.8/site-packages/pandas/core/tools/datetimes.py", line 728, in to_datetime
    values = convert_listlike(arg._values, format)
  File "/Users/maxsharabayko/projects/srt/lib-tcpdump-processing/venv/lib/python3.8/site-packages/pandas/core/tools/datetimes.py", line 435, in _convert_listlike_datetimes
    raise e
  File "/Users/maxsharabayko/projects/srt/lib-tcpdump-processing/venv/lib/python3.8/site-packages/pandas/core/tools/datetimes.py", line 399, in _convert_listlike_datetimes
    result, timezones = array_strptime(
  File "pandas/_libs/tslibs/strptime.pyx", line 142, in pandas._libs.tslibs.strptime.array_strptime
ValueError: time data 'Apr  1, 2020 16:29:53.150479000 CEST' does not match format '%b %d, %Y %H:%M:%S.%f %Z' (match)

Sample files

pcapng + CSV produced: srt-frametime-cest.zip

mbakholdina commented 1 year ago

Addressed in PR #47.