From d55cdb7785a76eaf5b8a49f16f503c1d23edf8e7 Mon Sep 17 00:00:00 2001 From: Casey Klein Date: Wed, 8 Dec 2010 15:20:27 -0600 Subject: [PATCH] Fixes a bug in `make-temporary-file' When (current-milliseconds) was negative, the string substituted into the template would contain non-digits, violating the promise in the documentation. --- collects/racket/file.rkt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/collects/racket/file.rkt b/collects/racket/file.rkt index d439d8e915..7af13d62e1 100644 --- a/collects/racket/file.rkt +++ b/collects/racket/file.rkt @@ -85,7 +85,8 @@ "path, valid-path, string, or #f" base-dir)) (let ([tmpdir (find-system-path 'temp-dir)]) - (let loop ([s (current-seconds)][ms (current-milliseconds)]) + (let loop ([s (current-seconds)] + [ms (inexact->exact (truncate (current-inexact-milliseconds)))]) (let ([name (let ([n (format template (format "~a~a" s ms))]) (cond [base-dir (build-path base-dir n)] [(relative-path? n) (build-path tmpdir n)]