[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/01: cache: Work around 'time-monotonic' bug in Guile 2.2.2.
From: |
Ludovic Courtès |
Subject: |
01/01: cache: Work around 'time-monotonic' bug in Guile 2.2.2. |
Date: |
Sat, 22 Apr 2017 08:51:27 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 25a49294caf2386e65fc1b12a2508324be0b1cc2
Author: Ludovic Courtès <address@hidden>
Date: Sat Apr 22 14:40:51 2017 +0200
cache: Work around 'time-monotonic' bug in Guile 2.2.2.
* guix/cache.scm (time-monotonic) [guile-2.2]: New variable.
* tests/cache.scm (time-monotonic) [guile-2.2]: Likewise.
* guix/build/download.scm (time-monotonic) [guile-2.2]: Adjust comment:
it's a 2.2.2 bug.
---
guix/build/download.scm | 5 ++---
guix/cache.scm | 7 +++++++
tests/cache.scm | 7 +++++++
3 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/guix/build/download.scm b/guix/build/download.scm
index 6563341..67a8952 100644
--- a/guix/build/download.scm
+++ b/guix/build/download.scm
@@ -142,9 +142,8 @@ Otherwise return STORE-PATH."
(cond-expand
(guile-2.2
- ;; Guile 2.2.0 to 2.2.2 included has a bug whereby 'time-monotonic' objects
- ;; have seconds and nanoseconds swapped (fixed in Guile commit 886ac3e).
- ;; Work around it.
+ ;; Guile 2.2.2 has a bug whereby 'time-monotonic' objects have seconds and
+ ;; nanoseconds swapped (fixed in Guile commit 886ac3e). Work around it.
(define time-monotonic time-tai))
(else #t))
diff --git a/guix/cache.scm b/guix/cache.scm
index 077b078..1dc0083 100644
--- a/guix/cache.scm
+++ b/guix/cache.scm
@@ -33,6 +33,13 @@
;;;
;;; Code:
+(cond-expand
+ (guile-2.2
+ ;; Guile 2.2.2 has a bug whereby 'time-monotonic' objects have seconds and
+ ;; nanoseconds swapped (fixed in Guile commit 886ac3e). Work around it.
+ (define time-monotonic time-tai))
+ (else #t))
+
(define (obsolete? date now ttl)
"Return #t if DATE is obsolete compared to NOW + TTL seconds."
(time>? (subtract-duration now (make-time time-duration 0 ttl))
diff --git a/tests/cache.scm b/tests/cache.scm
index 0e1e08b..e46cdd8 100644
--- a/tests/cache.scm
+++ b/tests/cache.scm
@@ -24,6 +24,13 @@
#:use-module ((guix utils) #:select (call-with-temporary-directory))
#:use-module (ice-9 match))
+(cond-expand
+ (guile-2.2
+ ;; Guile 2.2.2 has a bug whereby 'time-monotonic' objects have seconds and
+ ;; nanoseconds swapped (fixed in Guile commit 886ac3e). Work around it.
+ (define time-monotonic time-tai))
+ (else #t))
+
(test-begin "cache")
(test-equal "remove-expired-cache-entries"