Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
36e80306
Unverified
Commit
36e80306
authored
Jul 16, 2021
by
Edward Thomson
Committed by
GitHub
Jul 16, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5945 from boretrk/resynctimer
git__timer: Allow compilation on systems without CLOCK_MONOTONIC
parents
f15a6792
e4e173e8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
12 deletions
+13
-12
src/pack-objects.c
+2
-2
src/transports/smart_protocol.c
+2
-1
src/util.h
+9
-9
No files found.
src/pack-objects.c
View file @
36e80306
...
...
@@ -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
(
...
...
src/transports/smart_protocol.c
View file @
36e80306
...
...
@@ -975,9 +975,10 @@ static int stream_thunk(void *buf, size_t size, void *data)
if
(
payload
->
cb
)
{
double
current_time
=
git__timer
();
double
elapsed
=
current_time
-
payload
->
last_progress_report_time
;
payload
->
last_bytes
+=
size
;
if
(
(
current_time
-
payload
->
last_progress_report_time
)
>=
MIN_PROGRESS_UPDATE_INTERVAL
)
{
if
(
elapsed
<
0
||
elapsed
>=
MIN_PROGRESS_UPDATE_INTERVAL
)
{
payload
->
last_progress_report_time
=
current_time
;
error
=
payload
->
cb
(
payload
->
pb
->
nr_written
,
payload
->
pb
->
nr_objects
,
payload
->
last_bytes
,
payload
->
cb_payload
);
}
...
...
src/util.h
View file @
36e80306
...
...
@@ -376,17 +376,17 @@ GIT_INLINE(double) git__timer(void)
GIT_INLINE
(
double
)
git__timer
(
void
)
{
struct
time
spec
tp
;
struct
time
val
tv
;
if
(
clock_gettime
(
CLOCK_MONOTONIC
,
&
tp
)
==
0
)
{
#ifdef CLOCK_MONOTONIC
struct
timespec
tp
;
if
(
clock_gettime
(
CLOCK_MONOTONIC
,
&
tp
)
==
0
)
return
(
double
)
tp
.
tv_sec
+
(
double
)
tp
.
tv_nsec
/
1.0E9
;
}
else
{
/* Fall back to using gettimeofday */
struct
timeval
tv
;
struct
timezone
tz
;
gettimeofday
(
&
tv
,
&
tz
);
return
(
double
)
tv
.
tv_sec
+
(
double
)
tv
.
tv_usec
/
1.0E6
;
}
#endif
/* Fall back to using gettimeofday */
gettimeofday
(
&
tv
,
NULL
);
return
(
double
)
tv
.
tv_sec
+
(
double
)
tv
.
tv_usec
/
1.0E6
;
}
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment