🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: demon.ip.developers
Article #518

Re: Small timezone bug in KA9Q/SMTPSERV.C

#518
From: Peter Fokker
Date: Tue, 06 May 1997 00:00
32 lines
1712 bytes
In article <5kcnhc$cqi@bhars12c.bnr.co.uk> adsb@bnr.co.uk "Andrew Benham" writes:

> Another problem is that:
> 
> >        /* Are we in DST? */
> >
> >        if (now < dst_start || now >= std_start)
> >                return (0);
> 
> assumes that   dst_start < std_start   which is only true in the Northern
> Hemisphere. E.g. if DST starts in October, and STD starts in April, then
> the test goes wrong.

I didn't look very closely at the code in tzset.c (yet) but I think you
raise a very good point. Too many assumptions in code leads to
unpredictable programs, especially when the assumptions are
'hidden' and/or undocumented. (e.g. all characters between 'A' and 'Z'
have contiguous 8-bit codes: true in ASCII but not in EBCDIC).

In my opinion the complete DST-issue seems wasteful: why have DST at all?
(this is a retorical question).

Of course the code you quote could easily be modified to return the correct
value, e.g.

    if ((now < dst_start || std_start <= now) ^ (std_start < dst_start))
        return(0);

but that is beside the point I guess.

--Peter Fokker
Technical Details
Message-ID: <862904412snz@fokker.demon.nl>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <862463261snz@fokker.demon.nl> <862506921snz.8460@grempc.demon.co.uk> <5kcnhc$cqi@bhars12c.bnr.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10bb05,723f93803c1763df
X-Google-Attributes: gid10bb05,public
From: Peter@fokker.demon.nl (Peter Fokker)
Subject: Re: Small timezone bug in KA9Q/SMTPSERV.C
Date: 1997/05/06
Message-ID: <862904412snz@fokker.demon.nl>
X-Deja-AN: 239873277
References: <862463261snz@fokker.demon.nl> <862506921snz.8460@grempc.demon.co.uk> <5kcnhc$cqi@bhars12c.bnr.co.uk>
X-Mail2News-User: Peter@fokker.demon.nl
X-Mail2News-Path: fokker.demon.nl
Organization: Ingenieursbureau PSD
Reply-To: peter@fokker.demon.nl
Newsgroups: demon.ip.developers