chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] rfc822


From: Daishi Kato
Subject: Re: [Chicken-users] rfc822
Date: Fri, 4 Aug 2006 12:55:50 +0900

Why couldn't it simply be this?

          (let ([quot (quotient tz 100)]
                [rem (remainder tz 100)])
            (+ (* quot 3600) (* rem 60)))

On 8/4/06, Kon Lovett <address@hidden> wrote:
On Aug 3, 2006, at 6:13 PM, Daishi Kato wrote:

> On 8/4/06, Kon Lovett <address@hidden> wrote:
>> > P.S. Can anybody explain why it does "abs" for rem?
>>
>> Probably because tz could be negative & only one breakdown component
>> should carry the sign.
>
> I may misunderstand something, but
> if the tz is -230, it is going to be -5400 instead of -9000.
> Is it what it should be?

Spoke w/o looking at the code.

The expr looks wrong to me. I think this is a better way to get the
offset in seconds:

        (if (zero? tz)
            0
            (let ([hr (abs (quotient tz 100))]) [mn (abs (remainder tz 100))])
                (* (signum tz) (+ (* hr 3600) (* mn 60)))))

>
> Daishi






reply via email to

[Prev in Thread] Current Thread [Next in Thread]