* Re: guile 1.8.5 solaris 10 sparc with gcc strftime testing
@ 2008-08-26 18:12 ras
0 siblings, 0 replies; only message in thread
From: ras @ 2008-08-26 18:12 UTC (permalink / raw)
To: bug-guile
aloha Ludovic
with respect to solaris 10 sparc and the strftime tests
the guile-1.8.5 check-guile.log shows that the first strftime test
passes:
PASS: time.test: strftime: C99 %z format: GMT
but the second test fails
FAIL: time.test: strftime: C99 %z format: EST+5
using csh with LC_ALL=C and TZ=US/Pacific
date '+%z' yields
-0700
if i alter TZ
setenv TZ GMT+0 ( to that for the first test )
+0000
as expected
setenv TZ EST+5 ( to that for the second test )
-0500
which seems to be what the test expects, but apparently isn't getting back.
it's a shame what was returned from the strftime call isn't logged.
running the tests/time.test manually with --debug doesn't yield any more
information about what was returned ...
sorry i can't be of more help ... well i'm unable to resist the challenge
but i don't know scheme or the guile implementation so what appears below
should be considered naive
hacking into tests/time.test just after the (pass-if "GMT" ... block
(display (let ((tm (localtime 86400)))
(strftime "%z" tm)))
(newline)
i'm getting
+0000
so i then added similar code just after the (pass-if "EST+5" ... block
and also am getting
+0000
with a bit more playing around it is looking to me like the sun strftime
isn't doing what the manpage suggests, but then this section could be a
bit more clear about what timezone is exactly and what exactly is returned
in place of %z.
%z Replaced by offset from UTC in ISO 8601:2000 stan-
dard format (+hhmm or -hhmm), or by no characters
if no timezone is determinable. For example, "-
0430" means 4 hours 30 minutes behind UTC (west of
Greenwich). If tm_isdst is zero, the standard time
offset is used. If tm_isdst is greater than zero,
the daylight savings time offset if used. If
tm_isdst is negative, no characters are returned.
as near as i can determine, the %z flag will always return +0000
with the time (hour/min) adjusted the according to the value specified in the
TZ envvar. e.g. TZ=EST+5 is returning %c %z as 'Thu Jan 01 19:00:00 1970 +0000',
TZ=GMT+8 results in %c %z returning 'Thu Jan 01 16:00:00 1970 +0000'
and TZ=GMT-1 results in %c %z returning 'Fri Jan 02 01:00:00 1970 +0000'.
without a (recognized) timezone string in TZ but with an offset, there
is no time adjustment at all. e.g. TZ=-0800 results in %c %z returning
'Fri Jan 02 00:00:00 1970 +0000' and as i show in the followup below
TZ=+0000 results in %c %z returning 'Fri Jan 02 00:00:00 1970 +0000'.
i might note that my locale is C and for that locale on sol10 LC_TIME is empty
hope this helps resolve the test problem for solaris ... yell if i can eval
anything further ...
regards
ras
couple of followups:
while the csh session indicates that TZ = EST+5 yielding via a
date command like: /usr/bin/date '+%z'
-0500
means the time.test should pass, the testing result differs, returning
timezone of +0000 but with the time (hhmm) adjusted in accordance with
EST+5:
;; prior to guile 1.6.9 and 1.8.1 this test failed, getting "+0500",
;; because we didn't adjust for tm:gmtoff being west of Greenwich versus
;; tm_gmtoff being east of Greenwich
(pass-if "EST+5"
(or have-strftime-%z (throw 'unsupported))
(putenv "TZ=EST+5")
(tzset)
(display "tz expect: EST+5 :: ")
(display (getenv "TZ"))
(newline)
(let ((tm (localtime 86400)))
(string=? "+0000" (strftime "%z" tm))))
;;; this was changed^^^^ from -0500
(display "date expect: +0000 :: ")
(display (let ((tm (localtime 86400)))
(strftime "%c %z" tm)))
(newline)
(newline)
prints
tz expect: EST+5 :: EST+5
date expect: +0000 :: Thu Jan 01 19:00:00 1970 +0000
note time has been adjusted ^^ to EST
Ludo' asked:
So what does "(strftime "%z" (gmtime 0))" return? Do you mean that it's
"+0000"?
yes ... as i show below.
from the csh:
setenv TZ 0
/usr/bin/date '+%c %z'
Tue Aug 26 17:17:53 2008 +0000
and
setenv TZ +0000
/usr/bin/date '+%z'
+0000
a hacked tests/time.test
with
(pass-if "+0000"
(or have-strftime-%z (throw 'unsupported))
(putenv "TZ=+0000")
(tzset)
(display "+0000 tz expect: +0000 :: ")
(display (getenv "TZ"))
(newline)
(let ((tm (localtime 86400)))
(string=? "+0000" (strftime "%z" tm))))
(display "date expect: +0000 :: ")
(display (let ((tm (localtime 86400)))
(strftime "%c %z" tm)))
(newline)
(newline)
prints:
+0000 tz expect: +0000 :: +0000
date expect: +0000 :: Fri Jan 02 00:00:00 1970 +0000
i googled strftime and found margin notes to strftime that might
be part of this issue, but don't know internals well enough to
really know. here's the url:
http://www.opengroup.org/onlinepubs/009695399/functions/strftime.html
aloha
ras
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-08-26 18:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-26 18:12 guile 1.8.5 solaris 10 sparc with gcc strftime testing ras
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).