From: Greg Troxel <gdt@ir.bbn.com>
Cc: guile-devel@gnu.org
Subject: Re: 1.6.8 release candidate 0 available for testing.
Date: 18 Oct 2005 15:53:30 -0400 [thread overview]
Message-ID: <rmir7aiy539.fsf@fnord.ir.bbn.com> (raw)
In-Reply-To: <87y84taxzo.fsf@zip.com.au>
Kevin Ryde <user42@zip.com.au> writes:
> Greg Troxel <gdt@ir.bbn.com> 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 <gdt@ir.bbn.com>
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2005-10-18 19:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-15 20:55 1.6.8 release candidate 0 available for testing Rob Browning
2005-10-16 21:02 ` Greg Troxel
2005-10-16 22:38 ` Kevin Ryde
2005-10-18 19:53 ` Greg Troxel [this message]
2005-10-19 1:27 ` Kevin Ryde
2005-10-19 17:10 ` Greg Troxel
2005-10-20 7:32 ` Ludovic Courtès
2005-10-19 1:34 ` Kevin Ryde
2005-10-19 17:18 ` Greg Troxel
2005-10-23 22:27 ` Kevin Ryde
2005-10-25 1:29 ` Greg Troxel
2005-10-31 23:41 ` Kevin Ryde
2005-10-23 22:41 ` Kevin Ryde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=rmir7aiy539.fsf@fnord.ir.bbn.com \
--to=gdt@ir.bbn.com \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).