Skip to content

Commit

Permalink
fix time zone issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rerpha committed Oct 10, 2024
1 parent 42d5708 commit c235395
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ dependencies = [
"matplotlib",
"numpy",
"scipp",
"tzdata",
]

[project.optional-dependencies]
Expand Down
5 changes: 4 additions & 1 deletion src/ibex_bluesky_core/callbacks/file_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from event_model.documents.event_descriptor import EventDescriptor
from event_model.documents.run_start import RunStart
from event_model.documents.run_stop import RunStop
from zoneinfo import ZoneInfo

TIME = "time"
START_TIME = "start_time"
Expand Down Expand Up @@ -61,7 +62,9 @@ def start(self, doc: RunStart) -> None:
header_data = {k: v for k, v in doc.items() if k not in exclude_list}

datetime_obj = datetime.fromtimestamp(doc[TIME])
formatted_time = datetime_obj.strftime("%Y-%m-%d %H:%M:%S")
formatted_time = datetime_obj.astimezone(ZoneInfo("Europe/London")).strftime(
"%Y-%m-%d %H:%M:%S"
)
header_data[START_TIME] = formatted_time

with open(self.filename, "a") as outfile:
Expand Down

0 comments on commit c235395

Please sign in to comment.