async def do_rollover(self):
        """
        do a rollover; in this case, a date/time stamp is appended to the filename
        when the rollover happens.  However, you want the file to be named for the
        start of the interval, not the current time.  If there is a backup count,
        then we have to get a list of matching filenames, sort them and remove
        the one with the oldest suffix.
        """
        if self.stream:
            await self.stream.close()
            self.stream = None
        # get the time that this sequence started at and make it a TimeTuple
        current_time = int(time.time())
        dst_now = time.localtime(current_time)[-1]
        t = self.rollover_at - self.interval
        if self.utc:
            time_tuple = time.gmtime(t)
        else:
            time_tuple = time.localtime(t)
            dst_then = time_tuple[-1]
            if dst_now != dst_then:
                if dst_now:
                    addend = ONE_HOUR_IN_SECONDS
                else:
                    addend = -ONE_HOUR_IN_SECONDS
                time_tuple = time.localtime(t + addend)
        destination_file_path = self.rotation_filename(
            self.absolute_file_path
            + "."
            + time.strftime(self.suffix, time_tuple)
        )
        if await self.loop.run_in_executor(
            None, lambda: os.path.exists(destination_file_path)
        ):
            await self.loop.run_in_executor(
                None, lambda: os.unlink(destination_file_path)
            )
        await self.rotate(self.absolute_file_path, destination_file_path)
        if self.backup_count > 0:
            files_to_delete = await self.get_files_to_delete()
            if files_to_delete:
                await self._delete_files(files_to_delete)

        await self._init_writer()
        new_rollover_at = self.compute_rollover(current_time)
        while new_rollover_at <= current_time:
            new_rollover_at = new_rollover_at + self.interval
        # If DST changes and midnight or weekly rollover, adjust for this.
        if (
            self.when == RolloverInterval.MIDNIGHT
            or self.when in RolloverInterval.WEEK_DAYS
        ) and not self.utc:
            dst_at_rollover = time.localtime(new_rollover_at)[-1]
            if dst_now != dst_at_rollover:
                if not dst_now:
                    # DST kicks in before next rollover, so we need to deduct an hour
                    addend = -ONE_HOUR_IN_SECONDS
                else:
                    # DST bows out before next rollover, so we need to add an hour
                    addend = ONE_HOUR_IN_SECONDS
                new_rollover_at += addend
        self.rollover_at = new_rollover_at
async def do_rollover ( self ) : if self . stream : await self . stream . close ( ) self . stream = None current_time = int ( time . time ( ) ) dst_now = time . localtime ( current_time ) [ - 1 ] t = self . rollover_at - self . interval if self . utc : time_tuple = time . gmtime ( t ) else : time_tuple = time . localtime ( t ) dst_then = time_tuple [ - 1 ] if dst_now != dst_then : if dst_now : addend = ONE_HOUR_IN_SECONDS else : addend = - ONE_HOUR_IN_SECONDS time_tuple = time . localtime ( t + addend ) destination_file_path = self . rotation_filename ( self . absolute_file_path + "." + time . strftime ( self . suffix , time_tuple ) ) if await self . loop . run_in_executor ( None , lambda : os . path . exists ( destination_file_path ) ) : await self . loop . run_in_executor ( None , lambda : os . unlink ( destination_file_path ) ) await self . rotate ( self . absolute_file_path , destination_file_path ) if self . backup_count > 0 : files_to_delete = await self . get_files_to_delete ( ) if files_to_delete : await self . _delete_files ( files_to_delete ) await self . _init_writer ( ) new_rollover_at = self . compute_rollover ( current_time ) while new_rollover_at <= current_time : new_rollover_at = new_rollover_at + self . interval if ( self . when == RolloverInterval . MIDNIGHT or self . when in RolloverInterval . WEEK_DAYS ) and not self . utc : dst_at_rollover = time . localtime ( new_rollover_at ) [ - 1 ] if dst_now != dst_at_rollover : if not dst_now : addend = - ONE_HOUR_IN_SECONDS else : addend = ONE_HOUR_IN_SECONDS new_rollover_at += addend self . rollover_at = new_rollover_at
do a rollover; in this case, a date/time stamp is appended to the filename
        when the rollover happens.  However, you want the file to be named for the
        start of the interval, not the current time.  If there is a backup count,
        then we have to get a list of matching filenames, sort them and remove
        the one with the oldest suffix.