From 2f42cea293dc966638fe57363822ff74318096bc Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Thu, 19 Oct 2000 21:34:19 +0000 Subject: [PATCH] Allow ctime() input strings to lack seconds field. This isn't strictly correct but occurs sometimes on unix-mail from lines. --- v7/src/runtime/datime.scm | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/v7/src/runtime/datime.scm b/v7/src/runtime/datime.scm index 1005acb36..733429f8b 100644 --- a/v7/src/runtime/datime.scm +++ b/v7/src/runtime/datime.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: datime.scm,v 14.32 2000/09/11 21:50:03 cph Exp $ +$Id: datime.scm,v 14.33 2000/10/19 21:34:19 cph Exp $ Copyright (c) 1988-2000 Massachusetts Institute of Technology @@ -345,15 +345,25 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. (if (not (fix:= 5 (length tokens))) (lose)) (let ((time (burst-string (list-ref tokens 3) #\: #f))) - (if (not (fix:= 3 (length time))) - (lose)) - (make-decoded-time (string->number (caddr time)) - (string->number (cadr time)) - (string->number (car time)) - (string->number (list-ref tokens 2)) - (string->month (list-ref tokens 1)) - (string->year (list-ref tokens 4)) - zone))))) + (case (length time) + ((3) + (make-decoded-time (string->number (caddr time)) + (string->number (cadr time)) + (string->number (car time)) + (string->number (list-ref tokens 2)) + (string->month (list-ref tokens 1)) + (string->year (list-ref tokens 4)) + zone)) + ((2) + (make-decoded-time 0 + (string->number (cadr time)) + (string->number (car time)) + (string->number (list-ref tokens 2)) + (string->month (list-ref tokens 1)) + (string->year (list-ref tokens 4)) + zone)) + (else + (lose))))))) (define (universal-time->local-ctime-string time) (decoded-time->ctime-string (universal-time->local-decoded-time time))) -- 2.25.1