Skip to content

Commit

Permalink
Removing dateutil from previous commit (#404)
Browse files Browse the repository at this point in the history
* adding pip install

* porting from dateutil to datetime
  • Loading branch information
HowieG authored Sep 18, 2024
1 parent ffa5a15 commit 6c9f892
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions agentops/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from termcolor import colored
from typing import Optional, List, Union
from uuid import UUID, uuid4
from dateutil import parser
from datetime import datetime

from .exceptions import ApiServerException
from .enums import EndState
Expand Down Expand Up @@ -106,7 +106,10 @@ def end_session(
self._flush_queue()

def format_duration(start_time, end_time):
duration = parser.parse(end_time) - parser.parse(start_time)
start = datetime.fromisoformat(start_time.replace("Z", "+00:00"))
end = datetime.fromisoformat(end_time.replace("Z", "+00:00"))
duration = end - start

hours, remainder = divmod(duration.total_seconds(), 3600)
minutes, seconds = divmod(remainder, 60)

Expand Down

0 comments on commit 6c9f892

Please sign in to comment.