File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -1511,17 +1511,22 @@ def add_truncated(self, other: 'TimePoint') -> 'TimePoint':
1511
1511
if second_of_minute is not None or minute_of_hour is not None :
1512
1512
new = new .to_hour_minute_second ()
1513
1513
if second_of_minute is not None :
1514
- while new ._second_of_minute != second_of_minute :
1515
- new ._second_of_minute += 1.0
1516
- new ._tick_over ()
1514
+ new ._second_of_minute += (
1515
+ (second_of_minute - new ._second_of_minute )
1516
+ % CALENDAR .SECONDS_IN_MINUTE
1517
+ )
1518
+ new ._tick_over ()
1517
1519
if minute_of_hour is not None :
1518
- while new ._minute_of_hour != minute_of_hour :
1519
- new ._minute_of_hour += 1.0
1520
- new ._tick_over ()
1520
+ new ._minute_of_hour += (
1521
+ (minute_of_hour - new ._minute_of_hour )
1522
+ % CALENDAR .MINUTES_IN_HOUR
1523
+ )
1524
+ new ._tick_over ()
1521
1525
if hour_of_day is not None :
1522
- while new ._hour_of_day != hour_of_day :
1523
- new ._hour_of_day += 1.0
1524
- new ._tick_over ()
1526
+ new ._hour_of_day += (
1527
+ (hour_of_day - new ._hour_of_day ) % CALENDAR .HOURS_IN_DAY
1528
+ )
1529
+ new ._tick_over ()
1525
1530
1526
1531
if day_of_week is not None :
1527
1532
new = new .to_week_date ()
You can’t perform that action at this time.
0 commit comments