Page 1 of 1

(parse-date)

Posted: Wed Mar 18, 2009 1:17 pm
by Excalibor
Greetings,

I'm writing a script for parsing the output of the 'last' command, and I have found that (parse-date) gives an error. This is in 10.0.2 in Windows (both in newLISP GS and using it with cygwin)

> (sys-info)
(391 268435456 367 1 0 2048 3268 10002 6)
> (parse-date)

ERR: invalid function : (parse-date)

Is there something I'm overseeing or is it a bug in the Windows release? v10.0.2 on GNU/Linux works fine, though...

Thanks a bunch!

Posted: Wed Mar 18, 2009 1:59 pm
by Lutz
The 'parse-date' function is not available on Windows:

http://www.newlisp.org/newlisp_manual.html#parse-date

Posted: Wed Mar 18, 2009 2:11 pm
by Excalibor
Lutz wrote:The 'parse-date' function is not available on Windows
That explains it all... Any reasons there's not one? Too hard to implement on windows, I guess...

I'll have to go manual with this one... :-P

thx anyway!

Posted: Wed Mar 18, 2009 2:39 pm
by Lutz
Although strptime(), the C function behind 'parse-date' is a POSIX function it is not supported on Windows. The public available C implementations are pretty big and typically made only for the English locale.

I suggest parsing the date string with newLISP using regular expressions and then feeding the values to the 'date-value' function.

Posted: Wed Mar 18, 2009 6:36 pm
by xytroxon
Lutz wrote:Although strptime(), the C function behind 'parse-date' is a POSIX function it is not supported on Windows.
While this may sound like a strange problem not to have been addressed and fixed long ago, the PHP language strptime function also is NOT supported in the Windows version of PHP!!!

http://us2.php.net/strptime

And PHP has many more people working on their code ;)

-- xytroxon

Posted: Fri Mar 20, 2009 6:06 pm
by Excalibor
Well, I see... it's a generalized WIndows problem...

Thanks for the advice, Lutz, I'll surely do as you say, it should be, anyway, easy enough...

laters!