summaryrefslogtreecommitdiff
path: root/src/pack-objects.c
diff options
context:
space:
mode:
authorPeter Pettersson <boretrk@hotmail.com>2021-07-15 21:00:02 +0200
committerPeter Pettersson <boretrk@hotmail.com>2021-07-15 21:00:02 +0200
commite4e173e8744dbdf9bed4b814f1af6a8080c4c603 (patch)
treeea41de624aae1e2289813c442bd7cc6508174ebf /src/pack-objects.c
parentf15a6792d382f7a9bf6d5c638417f2b436a144a9 (diff)
downloadlibgit2-e4e173e8744dbdf9bed4b814f1af6a8080c4c603.tar.gz
Allow compilation on systems without CLOCK_MONOTONIC
Makes usage of CLOCK_MONOTONIC conditional and makes functions that uses git__timer handle clock resynchronization. Call gettimeofday with tzp set to NULL as required by https://pubs.opengroup.org/onlinepubs/9699919799/functions/gettimeofday.html
Diffstat (limited to 'src/pack-objects.c')
-rw-r--r--src/pack-objects.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pack-objects.c b/src/pack-objects.c
index f9d8bfd35..2c964b125 100644
--- a/src/pack-objects.c
+++ b/src/pack-objects.c
@@ -251,7 +251,7 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
double current_time = git__timer();
double elapsed = current_time - pb->last_progress_report_time;
- if (elapsed >= MIN_PROGRESS_UPDATE_INTERVAL) {
+ if (elapsed < 0 || elapsed >= MIN_PROGRESS_UPDATE_INTERVAL) {
pb->last_progress_report_time = current_time;
ret = pb->progress_cb(
@@ -922,7 +922,7 @@ static int report_delta_progress(
double current_time = git__timer();
double elapsed = current_time - pb->last_progress_report_time;
- if (force || elapsed >= MIN_PROGRESS_UPDATE_INTERVAL) {
+ if (force || elapsed < 0 || elapsed >= MIN_PROGRESS_UPDATE_INTERVAL) {
pb->last_progress_report_time = current_time;
ret = pb->progress_cb(