Skip to content

Commit

Permalink
more liberal parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Dec 28, 2024
1 parent f8d09fc commit 5b0b7d0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pioreactor/utils/timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ def default_datetime_for_pioreactor(delta_seconds=0) -> datetime:


def to_datetime(timestamp: str) -> datetime:
return datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S.%fZ").replace(tzinfo=timezone.utc)
try:
return datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S.%fZ").replace(tzinfo=timezone.utc)
except ValueError:
return datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=timezone.utc)


class RepeatedTimer:
Expand Down

0 comments on commit 5b0b7d0

Please sign in to comment.