From 4e61ad85a5b6425c7b24aa4b3d2d857604dc0872 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Sun, 13 Oct 2013 12:10:38 -0700 Subject: [PATCH] improve debug --- debug.rkt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/debug.rkt b/debug.rkt index b98d901..a843e92 100644 --- a/debug.rkt +++ b/debug.rkt @@ -26,14 +26,17 @@ (define (make-date-string) (define date (current-date)) - (define date-fields (map (λ(x) (zero-fill x 2)) (list - (date-day date) - (list-ref months (sub1 (date-month date))) - (modulo (date-hour date) 12) - (date-minute date) - (date-second date) - ; (if (< (date-hour date) 12) "am" "pm") - ))) + (define date-fields (map (λ(x) (zero-fill x 2)) + (list + (date-day date) + (list-ref months (sub1 (date-month date))) + (if (<= (date-hour date) 12) + (date-hour date) ; am hours + noon hour + (modulo (date-hour date) 12)) ; pm hours after noon hour + (date-minute date) + (date-second date) + ; (if (< (date-hour date) 12) "am" "pm") + ))) (apply format "[~a-~a ~a:~a:~a]" date-fields)) (displayln (string-join `(,(make-date-string) ,@(map (λ(x)(if (string? x) x (~v x))) items))) (current-error-port)))