Skip to content

Commit

Permalink
changed utcnow() to now(datetime.UTC)
Browse files Browse the repository at this point in the history
  • Loading branch information
thusser committed Jun 17, 2024
1 parent a1d258c commit 37ad3c7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pyobs/modules/camera/basecamera.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ async def get_exposure_time_left(self, **kwargs: Any) -> float:

# calculate difference between start of exposure and now, and return in ms
duration = datetime.timedelta(seconds=self._exposure.exposure_time)
diff = self._exposure.start + duration - datetime.datetime.utcnow()
diff = self._exposure.start + duration - datetime.datetime.now(datetime.UTC)
return diff.total_seconds()

async def get_exposure_progress(self, **kwargs: Any) -> float:
Expand All @@ -191,7 +191,7 @@ async def get_exposure_progress(self, **kwargs: Any) -> float:
return 0.0

# calculate difference between start of exposure and now
diff = datetime.datetime.utcnow() - self._exposure[0]
diff = datetime.datetime.now(datetime.UTC) - self._exposure[0]

# zero exposure time?
if self._exposure.exposure_time == 0.0 or self._camera_status == ExposureStatus.READOUT:
Expand All @@ -207,7 +207,7 @@ async def _expose(self, exposure_time: float, open_shutter: bool, abort_event: a
Args:
exposure_time: The requested exposure time in seconds.
open_shutter: Whether or not to open the shutter.
open_shutter: Whether to open the shutter.
abort_event: Event that gets triggered when exposure should be aborted.
Returns:
Expand All @@ -224,7 +224,7 @@ async def __expose(self, exposure_time: float, image_type: ImageType, broadcast:
Args:
exposure_time: The requested exposure time in seconds.
image_type: Type of image.
broadcast: Whether or not the new image should be broadcasted.
broadcast: Whether the new image should be broadcasted.
Returns:
Tuple of the image itself and its filename.
Expand All @@ -243,7 +243,7 @@ async def __expose(self, exposure_time: float, image_type: ImageType, broadcast:
self.expose_abort.clear()

# do the exposure
self._exposure = ExposureInfo(start=datetime.datetime.utcnow(), exposure_time=exposure_time)
self._exposure = ExposureInfo(start=datetime.datetime.now(datetime.UTC), exposure_time=exposure_time)
try:
image = await self._expose(exposure_time, open_shutter, abort_event=self.expose_abort)
if image is None or image.safe_data is None:
Expand Down

0 comments on commit 37ad3c7

Please sign in to comment.