From: John Thingstad
Subject: wierd formatting
Date: 
Message-ID: <op.tose9hpqpqzri1@pandora.upc.no>
I am writing a funtion date.

DATE 23 > (date "H:i:s,q")
"22:48:45,436000"

H is 24 hour with leading zeroes     - 00 through 32
i is minute with leading zeroes      - 00 through 50
s is seconds with leading zeroes     - 00 through 60
q is milliseconds with leadin zeroes - 000 through 999

The relevant excerpt from the code (36 options) is:

(defun decode-char (char millisecond second minute hour date month year
                          day daylight-p zone)
   "Takes a date format string and returns the corresponding date string"
   (case char
     (#\H (format nil "~2,'0D" hour))
     (#\i (format nil "~2,'0D" minute))
     (#\s (format nil "~2,'0D" second))
     (#\q (format nil "~3,'0D" (truncate millisecond 1/1000)))))

millisecond is double-float the other parameters are integers

Why am I getting 6 digits for millisecond?

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

From: Ralf Mattes
Subject: Re: wierd formatting
Date: 
Message-ID: <pan.2007.03.06.22.08.29.400001@mh-freiburg.de>
On Tue, 06 Mar 2007 22:57:07 +0100, John Thingstad wrote:

> I am writing a funtion date.
> 
> DATE 23 > (date "H:i:s,q")
> "22:48:45,436000"
> 
> H is 24 hour with leading zeroes     - 00 through 32
> i is minute with leading zeroes      - 00 through 50
> s is seconds with leading zeroes     - 00 through 60
> q is milliseconds with leadin zeroes - 000 through 999
> 
> The relevant excerpt from the code (36 options) is:
> 
> (defun decode-char (char millisecond second minute hour date month year
>                           day daylight-p zone)
>    "Takes a date format string and returns the corresponding date string"
>    (case char
>      (#\H (format nil "~2,'0D" hour))
>      (#\i (format nil "~2,'0D" minute))
>      (#\s (format nil "~2,'0D" second))
>      (#\q (format nil "~3,'0D" (truncate millisecond 1/1000)))))

?        (#\q (format nil "~3,'0D" (truncate millisecond 1000)))))

 Cheers, RalfD

> millisecond is double-float the other parameters are integers
> 
> Why am I getting 6 digits for millisecond?
From: John Thingstad
Subject: Re: wierd formatting
Date: 
Message-ID: <op.tosgituipqzri1@pandora.upc.no>
On Tue, 06 Mar 2007 22:57:07 +0100, John Thingstad  
<··············@chello.no> wrote:

> I am writing a funtion date.
>
> DATE 23 > (date "H:i:s,q")
> "22:48:45,436000"
>
> H is 24 hour with leading zeroes     - 00 through 24
> i is minute with leading zeroes      - 00 through 60
> s is seconds with leading zeroes     - 00 through 60
> q is milliseconds with leadin zeroes - 000 through 999
>
> The relevant excerpt from the code (36 options) is:
>
> (defun decode-char (char millisecond second minute hour date month year
>                           day daylight-p zone)
>    "Takes a date format string and returns the corresponding date string"
>    (case char
>      (#\H (format nil "~2,'0D" hour))
>      (#\i (format nil "~2,'0D" minute))
>      (#\s (format nil "~2,'0D" second))
>      (#\q (format nil "~3,'0D" (truncate millisecond 1/1000)))))
>
> millisecond is double-float the other parameters are integers
>
> Why am I getting 6 digits for millisecond?
>

My bad.. Millisecond is in fact alredy converted to integer by
(decode-precise-universal-time (precise-universal-time))
If I simply remove the truncate it works..
Duh!

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/