def compute_rollover(self, current_time: int) -> int:
result = current_time + self.interval<EOL>if (<EOL>self.when == RolloverInterval.MIDNIGHT<EOL>or self.when in RolloverInterval.WEEK_DAYS<EOL>):<EOL><INDENT>if self.utc:<EOL><INDENT>t = time.gmtime(current_time)<EOL><DEDENT>else:<EOL><INDENT>t = time.localtime(current_time)<EOL><DEDENT>current_hour = t[<NUM_LIT:3>]<EOL>current_minute = t[<NUM_LIT:4>]<EOL>current_second = t[<NUM_LIT:5>]<EOL>current_day = t[<NUM_LIT:6>]<EOL>if self.at_time is None:<EOL><INDENT>rotate_ts = ONE_DAY_IN_SECONDS<EOL><DEDENT>else:<EOL><INDENT>rotate_ts = (<EOL>self.at_time.hour * <NUM_LIT> + self.at_time.minute<EOL>) * <NUM_LIT> + self.at_time.second<EOL><DEDENT>r = rotate_ts - (<EOL>(current_hour * <NUM_LIT> + current_minute) * <NUM_LIT> + current_second<EOL>)<EOL>if r < <NUM_LIT:0>:<EOL><INDENT>r += ONE_DAY_IN_SECONDS<EOL>current_day = (current_day + <NUM_LIT:1>) % <NUM_LIT:7><EOL><DEDENT>result = current_time + r<EOL>if self.when in RolloverInterval.WEEK_DAYS:<EOL><INDENT>day = current_day  <EOL>if day != self.day_of_week:<EOL><INDENT>if day < self.day_of_week:<EOL><INDENT>days_to_wait = self.day_of_week - day<EOL><DEDENT>else:<EOL><INDENT>days_to_wait = <NUM_LIT:6> - day + self.day_of_week + <NUM_LIT:1><EOL><DEDENT>new_rollover_at = result + (days_to_wait * (<NUM_LIT> * <NUM_LIT> * <NUM_LIT>))<EOL>if not self.utc:<EOL><INDENT>dst_now = t[-<NUM_LIT:1>]<EOL>dst_at_rollover = time.localtime(new_rollover_at)[-<NUM_LIT:1>]<EOL>if dst_now != dst_at_rollover:<EOL><INDENT>if not dst_now:<EOL><INDENT>addend = -ONE_HOUR_IN_SECONDS<EOL><DEDENT>else:<EOL><INDENT>addend = ONE_HOUR_IN_SECONDS<EOL><DEDENT>new_rollover_at += addend<EOL><DEDENT><DEDENT>result = new_rollover_at<EOL><DEDENT><DEDENT><DEDENT>return result<EOL>
Work out the rollover time based on the specified time.

If we are rolling over at midnight or weekly, then the interval is
already known. need to figure out is WHEN the next interval is.
In other words, if you are rolling over at midnight, then your base
interval is 1 day, but you want to start that one day clock at midnight,
 not now. So, we have to fudge the `rollover_at` value in order to trigger
 the first rollover at the right time.  After that, the regular interval
 will take care of the rest.  Note that this code doesn't care about
 leap seconds. :)