Add duration to the instance. :param hours: The number of hours :param minutes: The number of minutes :param seconds: The number of seconds :param microseconds: The number of microseconds
(
self, hours: int = 0, minutes: int = 0, seconds: int = 0, microseconds: int = 0
)
| 89 | # ADDITIONS AND SUBSTRACTIONS |
| 90 | |
| 91 | def add( |
| 92 | self, hours: int = 0, minutes: int = 0, seconds: int = 0, microseconds: int = 0 |
| 93 | ) -> Time: |
| 94 | """ |
| 95 | Add duration to the instance. |
| 96 | |
| 97 | :param hours: The number of hours |
| 98 | :param minutes: The number of minutes |
| 99 | :param seconds: The number of seconds |
| 100 | :param microseconds: The number of microseconds |
| 101 | """ |
| 102 | from pendulum.datetime import DateTime |
| 103 | |
| 104 | return ( |
| 105 | DateTime.EPOCH.at(self.hour, self.minute, self.second, self.microsecond) |
| 106 | .add( |
| 107 | hours=hours, minutes=minutes, seconds=seconds, microseconds=microseconds |
| 108 | ) |
| 109 | .time() |
| 110 | ) |
| 111 | |
| 112 | def subtract( |
| 113 | self, hours: int = 0, minutes: int = 0, seconds: int = 0, microseconds: int = 0 |