[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 52172d2 2/2: Fix gc-elapsed rounding bug
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master 52172d2 2/2: Fix gc-elapsed rounding bug |
Date: |
Sat, 14 Sep 2019 13:56:17 -0400 (EDT) |
branch: master
commit 52172d234015776bcc595c731477b98fa2949e50
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Fix gc-elapsed rounding bug
* src/alloc.c (garbage_collect): Don’t accumulate rounding
errors when computing gc-elapsed.
---
src/alloc.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/alloc.c b/src/alloc.c
index 497f600..9fbd0d0 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6021,9 +6021,10 @@ garbage_collect (void)
/* Accumulate statistics. */
if (FLOATP (Vgc_elapsed))
{
- struct timespec since_start = timespec_sub (current_timespec (), start);
- Vgc_elapsed = make_float (XFLOAT_DATA (Vgc_elapsed)
- + timespectod (since_start));
+ static struct timespec gc_elapsed;
+ gc_elapsed = timespec_add (gc_elapsed,
+ timespec_sub (current_timespec (), start));
+ Vgc_elapsed = make_float (timespectod (gc_elapsed));
}
gcs_done++;