Skip to content

Commit 6573f81

Browse files
author
Benjamin Moody
committed
_adjust_datetime: simplify calculation of base_datetime.
_adjust_datetime is called by _arrange_fields, which is called by rdrecord, in order to calculate the base date and time, given that a subset of the record has been selected (using sampfrom). Previously, this function would calculate base_datetime by combining base_date and base_time; this is now unnecessary because base_datetime is set implicitly when base_date and base_time are set. Likewise, it is unnecessary to set base_time and base_date afterwards, because these are set implicitly when base_datetime is set.
1 parent 9e12f8a commit 6573f81

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

wfdb/io/record.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -565,12 +565,7 @@ def _adjust_datetime(self, sampfrom):
565565
if sampfrom:
566566
dt_seconds = sampfrom / self.fs
567567
if self.base_date and self.base_time:
568-
self.base_datetime = datetime.datetime.combine(
569-
self.base_date, self.base_time
570-
)
571568
self.base_datetime += datetime.timedelta(seconds=dt_seconds)
572-
self.base_date = self.base_datetime.date()
573-
self.base_time = self.base_datetime.time()
574569
# We can calculate the time even if there is no date
575570
elif self.base_time:
576571
tmp_datetime = datetime.datetime.combine(

0 commit comments

Comments
 (0)