guile-devel
[Top][All Lists]
Advanced

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

Re: 1.6.8 release candidate 0 available for testing.


From: Greg Troxel
Subject: Re: 1.6.8 release candidate 0 available for testing.
Date: 18 Oct 2005 15:53:30 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Kevin Ryde <address@hidden> writes:

> Greg Troxel <address@hidden> writes:
>
> > FAIL: time.test: strftime %Z doesn't return garbage
> 
> Can you pick out the code from that test to see what it does return?
> (It's supposed to test that the timezone string passes straight
> through.)

strftime of %Z returns "EST", which is the correct time zone for the
program given no TZ in environment and isdst zero.  Comments in the
NetBSD libc sources indicate that returning the current zone is
a legitimate response according to C99.

gdt 133 ~ > cat time.scm
(define t (localtime (current-time)))

(display t)
(display "\n")

(set-tm:zone t "UTC")
(set-tm:isdst t 0)

(display t)
(display "\n")

(display (strftime "%F %T %Z" t))
(display "\n")

gdt 132 ~ > guile -s time.scm
#(15 37 15 18 9 105 2 290 1 14400 EDT)
#(15 37 15 18 9 105 2 290 0 14400 UTC)
2005-10-18 15:37:15 EST

There's a buglet in the guile info docs in that strftime has a cross
reference to the libc info file, and that would seem to be Linux
specific.  The docs also don't state if strftime in scheme is supposed
to conform to C99, translated into Scheme, or something else.  I note
that the strftime source in libguile accomodates systems w/o a
timezone field.  NetBSD's struct tm has one, but doesn't use it in
strftime:

In src/lib/libc/time/strftime.c:

                        case 'Z':
#ifdef TM_ZONE
                                if (t->TM_ZONE != NULL)
                                        pt = _add(t->TM_ZONE, pt, ptlim);
                                else
#endif /* defined TM_ZONE */
                                if (t->tm_isdst >= 0)
                                        pt = _add(tzname[t->tm_isdst != 0],
                                                pt, ptlim);
                                /*
                                ** C99 says that %Z must be replaced by the
                                ** empty string if the time zone is not
                                ** determinable.
                                */
                                continue;


This code is this way because using tm_zone would violate ISO-C; gory
details at:

http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=21722

So, I respectfully suggest that the test is demanding more than one
can rightfully conclude from the documentation.
Perhaps libguile/strftime.c needs to not assume that strftime(3) will examine
fields not specified by the standard, or perhaps that Scheme strftime
should define what it does more precisely.  A problem here is that
guile uses a structure which is bigger than C89 says.

I didn't find C99 specs for strftime, so I don't know if programs are
required to set tm_zone before calling strftime.

It would be interesting to run the test program from the PR on Linux.

Anyway, this isn't a new issue and has nothing to do with 1.6.8; have
seen this before but never tracked it down.  So whether it changes or
not, it's not in the way of a 1.6.8 release.





-- 
        Greg Troxel <address@hidden>




reply via email to

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