prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  TimeSensor triggers immediately when used over midnight (UTC)
  <!--
  
  Welcome to Apache Airflow!  For a smooth issue process, try to answer the following questions.
  Don't worry if they're not all applicable; just try to include what you can :-)
  
  If you need to include code snippets or logs, please put them in fenced code
  blocks.  If they're super-long, please use the details tag like
  <details><summary>super-long log</summary> lots of stuff </details>
  
  Please delete these comment blocks before submitting the issue.
  
  -->
  
  <!--
  
  IMPORTANT!!!
  
  PLEASE CHECK "SIMILAR TO X EXISTING ISSUES" OPTION IF VISIBLE
  NEXT TO "SUBMIT NEW ISSUE" BUTTON!!!
  
  PLEASE CHECK IF THIS ISSUE HAS BEEN REPORTED PREVIOUSLY USING SEARCH!!!
  
  Please complete the next sections or the issue will be closed.
  This questions are the first thing we need to know to understand the context.
  
  -->
  
  **Apache Airflow version**: 1.10.10 (issue exists in current master as well)
  
  **Environment**: does not seem relevant
  
  **What happened**:
  
  The TimeSensor does trigger if the current time is later than the defined trigger time. Looking at the [source code](https://github.com/apache/airflow/blob/master/airflow/sensors/time_sensor.py), the trigger rule is defined as
  ```
  return timezone.utcnow().time() > self.target_time
  ```
  This leads to problems when the DAG runs over midnight UTC. For example, suppose the following DAG:
  
  ```
  with DAG('foo', 
      default_args={'start_date': datetime(2020, 7, 1, tzinfo=pendulum.timezone("Europe/Berlin"))}, 
      schedule_interval="0 0 * * *") as dag:
  
      # in summer, Europe/Berlin is two hours after UTC, hence: 
      time_04h00_local = TimeSensor(task_id="time_01h30", target_time=time(hour=2, minute=00))
  ```
  
  This DAG will be triggered at 22:00 UTC. Then, according to the trigger rule:
  ```
  22:00 UTC > 2:00 UTC
  ```
  Hence, the TimeSensor will be triggered immediately. 
  
  **What you expected to happen**:
  
  The TimeSensor should trigger at the following day if `target_time < next_execution_date.time()`
  
  **Possible workarounds**:
  
  One can always use the TimeDeltaSensor to archive similar effects. This does result in code that is not as readable, though. 
  
  </issue>
  <code>
  [start of airflow/sensors/time_sensor.py]
  1 #
  2 # Licensed to the Apache Software Foundation (ASF) under one
  3 # or more contributor license agreements.  See the NOTICE file
  4 # distributed with this work for additional information
  5 # regarding copyright ownership.  The ASF licenses this file
  6 # to you under the Apache License, Version 2.0 (the
  7 # "License"); you may not use this file except in compliance
  8 # with the License.  You may obtain a copy of the License at
  9 #
  10 #   http://www.apache.org/licenses/LICENSE-2.0
  11 #
  12 # Unless required by applicable law or agreed to in writing,
  13 # software distributed under the License is distributed on an
  14 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15 # KIND, either express or implied.  See the License for the
  16 # specific language governing permissions and limitations
  17 # under the License.
  18 
  19 from airflow.sensors.base_sensor_operator import BaseSensorOperator
  20 from airflow.utils import timezone
  21 from airflow.utils.decorators import apply_defaults
  22 
  23 
  24 class TimeSensor(BaseSensorOperator):
  25     """
  26     Waits until the specified time of the day.
  27 
  28     :param target_time: time after which the job succeeds
  29     :type target_time: datetime.time
  30     """
  31 
  32     @apply_defaults
  33     def __init__(self, target_time, *args, **kwargs):
  34         super().__init__(*args, **kwargs)
  35         self.target_time = target_time
  36 
  37     def poke(self, context):
  38         self.log.info('Checking if the time (%s) has come', self.target_time)
  39         return timezone.utcnow().time() > self.target_time
  40
  [end of airflow/sensors/time_sensor.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/airflow/sensors/time_sensor.py b/airflow/sensors/time_sensor.py
  --- a/airflow/sensors/time_sensor.py
  +++ b/airflow/sensors/time_sensor.py
  @@ -36,4 +36,4 @@
   
       def poke(self, context):
           self.log.info('Checking if the time (%s) has come', self.target_time)
  -        return timezone.utcnow().time() > self.target_time
  +        return timezone.make_naive(timezone.utcnow()).time() > self.target_time
  
verification_info: {"golden_diff": "diff --git a/airflow/sensors/time_sensor.py b/airflow/sensors/time_sensor.py\n--- a/airflow/sensors/time_sensor.py\n+++ b/airflow/sensors/time_sensor.py\n@@ -36,4 +36,4 @@\n \n     def poke(self, context):\n         self.log.info('Checking if the time (%s) has come', self.target_time)\n-        return timezone.utcnow().time() > self.target_time\n+        return timezone.make_naive(timezone.utcnow()).time() > self.target_time\n", "issue": "TimeSensor triggers immediately when used over midnight (UTC)\n<!--\r\n\r\nWelcome to Apache Airflow!  For a smooth issue process, try to answer the following questions.\r\nDon't worry if they're not all applicable; just try to include what you can :-)\r\n\r\nIf you need to include code snippets or logs, please put them in fenced code\r\nblocks.  If they're super-long, please use the details tag like\r\n<details><summary>super-long log</summary> lots of stuff </details>\r\n\r\nPlease delete these comment blocks before submitting the issue.\r\n\r\n-->\r\n\r\n<!--\r\n\r\nIMPORTANT!!!\r\n\r\nPLEASE CHECK \"SIMILAR TO X EXISTING ISSUES\" OPTION IF VISIBLE\r\nNEXT TO \"SUBMIT NEW ISSUE\" BUTTON!!!\r\n\r\nPLEASE CHECK IF THIS ISSUE HAS BEEN REPORTED PREVIOUSLY USING SEARCH!!!\r\n\r\nPlease complete the next sections or the issue will be closed.\r\nThis questions are the first thing we need to know to understand the context.\r\n\r\n-->\r\n\r\n**Apache Airflow version**: 1.10.10 (issue exists in current master as well)\r\n\r\n**Environment**: does not seem relevant\r\n\r\n**What happened**:\r\n\r\nThe TimeSensor does trigger if the current time is later than the defined trigger time. Looking at the [source code](https://github.com/apache/airflow/blob/master/airflow/sensors/time_sensor.py), the trigger rule is defined as\r\n```\r\nreturn timezone.utcnow().time() > self.target_time\r\n```\r\nThis leads to problems when the DAG runs over midnight UTC. For example, suppose the following DAG:\r\n\r\n```\r\nwith DAG('foo', \r\n    default_args={'start_date': datetime(2020, 7, 1, tzinfo=pendulum.timezone(\"Europe/Berlin\"))}, \r\n    schedule_interval=\"0 0 * * *\") as dag:\r\n\r\n    # in summer, Europe/Berlin is two hours after UTC, hence: \r\n    time_04h00_local = TimeSensor(task_id=\"time_01h30\", target_time=time(hour=2, minute=00))\r\n```\r\n\r\nThis DAG will be triggered at 22:00 UTC. Then, according to the trigger rule:\r\n```\r\n22:00 UTC > 2:00 UTC\r\n```\r\nHence, the TimeSensor will be triggered immediately. \r\n\r\n**What you expected to happen**:\r\n\r\nThe TimeSensor should trigger at the following day if `target_time < next_execution_date.time()`\r\n\r\n**Possible workarounds**:\r\n\r\nOne can always use the TimeDeltaSensor to archive similar effects. This does result in code that is not as readable, though. \n", "before_files": [{"content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership.  The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License.  You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n\nfrom airflow.sensors.base_sensor_operator import BaseSensorOperator\nfrom airflow.utils import timezone\nfrom airflow.utils.decorators import apply_defaults\n\n\nclass TimeSensor(BaseSensorOperator):\n    \"\"\"\n    Waits until the specified time of the day.\n\n    :param target_time: time after which the job succeeds\n    :type target_time: datetime.time\n    \"\"\"\n\n    @apply_defaults\n    def __init__(self, target_time, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.target_time = target_time\n\n    def poke(self, context):\n        self.log.info('Checking if the time (%s) has come', self.target_time)\n        return timezone.utcnow().time() > self.target_time\n", "path": "airflow/sensors/time_sensor.py"}]}