Skip to content

Commit a35b3e7

Browse files
committed
Import timelib 2021.16
1 parent 566f902 commit a35b3e7

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
@@ -361,12 +361,21 @@ timelib_time *timelib_add_wall(timelib_time *old_time, timelib_rel_time *interva
361361
timelib_update_ts(t, NULL);
362362
}
363363

364-
do_range_limit(0, 1000000, 1000000, &interval->us, &interval->s);
365-
t->sse += bias * timelib_hms_to_seconds(interval->h, interval->i, interval->s);
366-
timelib_update_from_sse(t);
367-
t->us += interval->us * bias;
368-
if (bias == -1 && interval->us > 0) {
369-
t->sse--;
364+
if (interval->us == 0) {
365+
t->sse += bias * timelib_hms_to_seconds(interval->h, interval->i, interval->s);
366+
timelib_update_from_sse(t);
367+
} else {
368+
timelib_rel_time *temp_interval = timelib_rel_time_clone(interval);
369+
370+
do_range_limit(0, 1000000, 1000000, &temp_interval->us, &temp_interval->s);
371+
t->sse += bias * timelib_hms_to_seconds(temp_interval->h, temp_interval->i, temp_interval->s);
372+
timelib_update_from_sse(t);
373+
t->us += temp_interval->us * bias;
374+
375+
timelib_do_normalize(t);
376+
timelib_update_ts(t, NULL);
377+
378+
timelib_rel_time_dtor(temp_interval);
370379
}
371380
timelib_do_normalize(t);
372381
}

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 202115
34-
#define TIMELIB_EXTENDED_VERSION 20211501
35-
#define TIMELIB_ASCII_VERSION "2021.15"
33+
#define TIMELIB_VERSION 202116
34+
#define TIMELIB_EXTENDED_VERSION 20211601
35+
#define TIMELIB_ASCII_VERSION "2021.16"
3636

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

0 commit comments

Comments
 (0)