Hi all,

I'm trying to convert a time string to seconds and back and I'm having a
problem using string->time, local-time->seconds, and seconds->local-time
in unit posix:

CHICKEN
(c)2008-2011 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 4.7.0
openbsd-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
compiled 2011-06-01 on kili.jsbsystems.com (OpenBSD)

#;1> (use posix)
; loading library posix ...
#;2> (string->time "20110601235959" "%Y%m%d%H%M%S")
#(59 59 23 1 5 111 0 0 #f 0)
#;3> (seconds->local-time (local-time->seconds (list->vector (list 59 59
23 1 5 111 6 31 #f 0))))
#(59 59 0 2 5 111 4 152 #t 14400) ; tz info set, and off by an hour
#;4> (local-timezone-abbreviation)
"EDT"

string->time seems to be ignoring the local timezone, but
local-time->seconds and seconds->local-time are not.  This prevents me
from converting a string time to seconds and back.  I get back a different
answer than I input.

This bug cropped up when something set the dstflag and timezone values in
the vector and it seems that strptime isn't populating them, if they're
not specified in the format string.  I haven't figured out what the
something was, but I was suddenly getting results from string->time for
"20030102120000" having dstflag=#t and timezone=14400, which is clearly
wrong for the middle of the winter (for me, anyway).

Am I just dealing with a deficiency in strptime?

TIA,
Dave

_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to