unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: "Andreas Vögele" <voegelas@gmx.net>
Subject: Re: Patch for scm_strftime() in stime.c
Date: Sun, 2 May 2004 21:46:13 +0200	[thread overview]
Message-ID: <5E7FD87F-9C71-11D8-BCCF-000D93673682@gmx.net> (raw)
In-Reply-To: <633F02B4-9C47-11D8-BCCF-000D93673682@gmx.net>

[-- Attachment #1: Type: text/plain, Size: 1338 bytes --]

Andreas Vögele wrote:

> Hi,
>
> on HP-UX, test-suite/time.test fails. The problem is that there may be 
> a mismatch between the time zone name and the daylight savings time 
> setting.

I thought about this problem. It's probably better to fix the test 
instead of scm_strftime(). The test gets the local time and then sets 
the time zone to "ZOW". The daylights savings time indicator, which is 
currently set in Central Europe, is not unset. Since "ZOW" is not known 
to be a time zone where dst is in effect the function strftime() 
outputs an empty  time zone name on HP-UX. BTW, that explains why the 
time test didn't fail a couple of weeks ago. At that time dst wasn't in 
effect in Central Europe.

The patch that I sent this afternoon uses mktime() in scm_strftime() to 
fix the tm_isdst field. But IMHO it's better to fix the test even if 
that means that HP-UX and glibc-based systems behave differently in 
some cases. Or do you think that scm_strftime() should silently fix 
mismatches between the time zone name and dst?

If yes, then I'd remove #idef __hpux since other systems might behave 
similarly to HP-UX. On HP-UX, mktime() doesn't fail if the time zone 
and dst mismatch. Instead, tm_isdst is modified. I don't know about 
other systems, though.

A patch for time.test is attached.


[-- Attachment #2: time.test.diff --]
[-- Type: application/octet-stream, Size: 557 bytes --]

Index: time.test
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/test-suite/tests/time.test,v
retrieving revision 1.1
diff -u -r1.1 time.test
--- time.test	15 Jun 1999 14:09:53 -0000	1.1
+++ time.test	2 May 2004 19:20:39 -0000
@@ -24,5 +24,7 @@
 (pass-if "strftime %Z doesn't return garbage"
 	 (let ((t (localtime (current-time))))
 	   (vector-set! t 10 "ZOW")
+	   ; Make sure that daylight savings time is disabled.
+	   (vector-set! t 8 0)
 	   (string=? (strftime "%Z" t)
 		     "ZOW")))

[-- Attachment #3: Type: text/plain, Size: 136 bytes --]

_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile

  reply	other threads:[~2004-05-02 19:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-02 14:45 Patch for scm_strftime() in stime.c Andreas Vögele
2004-05-02 19:46 ` Andreas Vögele [this message]
2004-05-02 23:02   ` 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=5E7FD87F-9C71-11D8-BCCF-000D93673682@gmx.net \
    --to=voegelas@gmx.net \
    /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).