Re: [Chicken-users] BUG: posix#string->time

2012-11-03 Thread Jim Ursetto
It uses strptime internally which seems pretty inconsistent across platforms.  
%z is technically not a valid format specifier, but glibc and some other libs 
support it.  E.g. your examples actually all work on OS X 10.7.  But they fail 
completely on NetBSD 5.1.  You didn't mention your platform but I'm guessing 
Linux/glibc, where I observed the same behavior you mentioned.

I'm going to guess glibc's strptime rejects offsets outside the -12...+12 
range.  But I can't find any reference to problems with offsets outside -12 or 
+12 in glibc, so I don't know if this is a genuine bug in strptime or what.  

I would hesitate to rely on this function for parsing timezone offsets.  For 
what it's worth Python's native strptime method, which used to use the 
platform-specific library call, has used a portable version for years -- and 
doesn't support %z at all.

On Nov 2, 2012, at 6:18 AM, Andy Bennett wrote:

> Hi,
> 
> string->time from the posix egg doesn't seem to be able to parse
> timezones with an offset greater than 12 hours from UTC:
> 
> -
> #;63> (define x (cut string->time <> "%a, %d %b %Y %H:%M:%S %z"))
> #;64> (x "Fri, 02 Nov 2012 04:12:23 -1300")
> #f
> #;65> (x "Fri, 02 Nov 2012 04:12:23 -1200")
> #(23 12 4 2 10 112 5 306 #f 43200)
> #;66> (x "Fri, 02 Nov 2012 04:12:23 -1201")
> #f
> #;67> (x "Fri, 02 Nov 2012 04:12:23 +")
> #(23 12 4 2 10 112 5 306 #f 0)
> #;68> (x "Fri, 02 Nov 2012 04:12:23 +1200")
> #(23 12 4 2 10 112 5 306 #f -43200)
> #;69> (x "Fri, 02 Nov 2012 04:12:23 +1201")
> #f
> #;70> (x "Fri, 02 Nov 2012 04:12:23 +1300")
> #f
> #;71>
> -
> 
> NZ is currently +1300 so string->time cannot handle all worldwide
> "current time" values.
> 
> 
> Is this considered a bug?
> 
> 
> 
> Regards,
> @ndy
> 
> -- 
> andy...@ashurst.eu.org
> http://www.ashurst.eu.org/
> 0x7EBA75FF
> 
> 
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/chicken-users


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


[Chicken-users] BUG: posix#string->time

2012-11-02 Thread Andy Bennett
Hi,

string->time from the posix egg doesn't seem to be able to parse
timezones with an offset greater than 12 hours from UTC:

-
#;63> (define x (cut string->time <> "%a, %d %b %Y %H:%M:%S %z"))
#;64> (x "Fri, 02 Nov 2012 04:12:23 -1300")
#f
#;65> (x "Fri, 02 Nov 2012 04:12:23 -1200")
#(23 12 4 2 10 112 5 306 #f 43200)
#;66> (x "Fri, 02 Nov 2012 04:12:23 -1201")
#f
#;67> (x "Fri, 02 Nov 2012 04:12:23 +")
#(23 12 4 2 10 112 5 306 #f 0)
#;68> (x "Fri, 02 Nov 2012 04:12:23 +1200")
#(23 12 4 2 10 112 5 306 #f -43200)
#;69> (x "Fri, 02 Nov 2012 04:12:23 +1201")
#f
#;70> (x "Fri, 02 Nov 2012 04:12:23 +1300")
#f
#;71>
-

NZ is currently +1300 so string->time cannot handle all worldwide
"current time" values.


Is this considered a bug?



Regards,
@ndy

-- 
andy...@ashurst.eu.org
http://www.ashurst.eu.org/
0x7EBA75FF


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