File size: 495 Bytes
eafbf97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"""Utils specific for EPIC data."""
import datetime


def timestamp_to_seconds(timestamp: str):
    # Parse the timestamp string into a datetime object
    time_obj = datetime.datetime.strptime(timestamp, '%H:%M:%S.%f')

    # Calculate the total number of seconds using the timedelta object
    total_seconds = time_obj.time().second \
        + time_obj.time().minute * 60 \
        + time_obj.time().hour * 3600 \
        + time_obj.time().microsecond / 1000000
    
    return total_seconds