Skip to content

Commit 0d3061d

Browse files
committed
Import timelib 2021.15
1 parent 6cdfaf9 commit 0d3061d

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

ext/date/lib/interval.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,21 @@ timelib_time *timelib_sub_wall(timelib_time *old_time, timelib_rel_time *interva
405405
timelib_update_ts(t, NULL);
406406
}
407407

408-
do_range_limit(0, 1000000, 1000000, &interval->us, &interval->s);
409-
t->sse -= bias * timelib_hms_to_seconds(interval->h, interval->i, interval->s);
410-
timelib_update_from_sse(t);
411-
t->us -= interval->us * bias;
412-
if (bias == -1 && interval->us > 0) {
413-
t->sse++;
408+
if (interval->us == 0) {
409+
t->sse -= bias * timelib_hms_to_seconds(interval->h, interval->i, interval->s);
410+
timelib_update_from_sse(t);
411+
} else {
412+
timelib_rel_time *temp_interval = timelib_rel_time_clone(interval);
413+
414+
do_range_limit(0, 1000000, 1000000, &temp_interval->us, &temp_interval->s);
415+
t->sse -= bias * timelib_hms_to_seconds(temp_interval->h, temp_interval->i, temp_interval->s);
416+
timelib_update_from_sse(t);
417+
t->us -= temp_interval->us * bias;
418+
419+
timelib_do_normalize(t);
420+
timelib_update_ts(t, NULL);
421+
422+
timelib_rel_time_dtor(temp_interval);
414423
}
415424
timelib_do_normalize(t);
416425
}

ext/date/lib/timelib.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
# include "timelib_config.h"
3131
#endif
3232

33-
#define TIMELIB_VERSION 202114
34-
#define TIMELIB_EXTENDED_VERSION 20211401
35-
#define TIMELIB_ASCII_VERSION "2021.14"
33+
#define TIMELIB_VERSION 202115
34+
#define TIMELIB_EXTENDED_VERSION 20211501
35+
#define TIMELIB_ASCII_VERSION "2021.15"
3636

3737
#include <stdlib.h>
3838
#include <stdbool.h>

0 commit comments

Comments
 (0)