Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
caf7854a
Commit
caf7854a
authored
20 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
if the values allow it, avoid floting point math for the current speed
parent
6def0892
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/progress.c
+15
-4
15 additions, 4 deletions
lib/progress.c
with
15 additions
and
4 deletions
lib/progress.c
+
15
−
4
View file @
caf7854a
...
...
@@ -301,10 +301,21 @@ int Curl_pgrsUpdate(struct connectdata *conn)
if
(
0
==
span_ms
)
span_ms
=
1
;
/* at least one millisecond MUST have passed */
/* Calculate the average speed the last 'countindex' seconds */
data
->
progress
.
current_speed
=
(
curl_off_t
)
(
data
->
progress
.
speeder
[
nowindex
]
-
data
->
progress
.
speeder
[
checkindex
])
/
((
double
)
span_ms
/
1000
);
/* Calculate the average speed the last 'span_ms' milliseconds */
{
curl_off_t
amount
=
data
->
progress
.
speeder
[
nowindex
]
-
data
->
progress
.
speeder
[
checkindex
];
if
(
amount
>
0xffffffff
/
1000
)
/* the 'amount' value is bigger than would fit in 32 bits if
multiplied with 1000, so we use the double math for this */
data
->
progress
.
current_speed
=
(
curl_off_t
)
(
amount
/
(
span_ms
/
1000
.
0
));
else
/* the 'amount' value is small enough to fit within 32 bits even
when multiplied with 1000 */
data
->
progress
.
current_speed
=
amount
*
1000
/
span_ms
;
}
}
else
/* the first second we use the main average */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment