R
Reiner Merz
Hi,
I'm looking for advice on how to parse a timestamp string
according to the ISO 8601 specification.
For those unfamiliar with the standard, here's an example:
2003-09-09T23:00:00Z
A compact form of it can as well be without the minuses and
the colons or with timezone information.
The parser should be small and fast and fairly easy to
integrate into C. And if possible, I don't want to link to an
additional library.
I thought so far about doing it in lex/yacc (flex/bison) but
after thinking it through, I don't consider them to be the right
tools for the job.
Regexes would be exactly what I need but I don't want to have
a whole regex engine that calculates the pattern at runtime when
it's not necessary. There must be a cheaper way of doing it.
I've already searched the internet for a kind of regex
compiler/generator that would generate C code for my specific
regex but unfortunately I didn't find anything similar to what I
want.
Of course, I can do it the hard way by messing around with
the string functions in string.h but if I can avoid that I'll do
so.
Any suggestions are appreciated.
Thanks
Reiner
I'm looking for advice on how to parse a timestamp string
according to the ISO 8601 specification.
For those unfamiliar with the standard, here's an example:
2003-09-09T23:00:00Z
A compact form of it can as well be without the minuses and
the colons or with timezone information.
The parser should be small and fast and fairly easy to
integrate into C. And if possible, I don't want to link to an
additional library.
I thought so far about doing it in lex/yacc (flex/bison) but
after thinking it through, I don't consider them to be the right
tools for the job.
Regexes would be exactly what I need but I don't want to have
a whole regex engine that calculates the pattern at runtime when
it's not necessary. There must be a cheaper way of doing it.
I've already searched the internet for a kind of regex
compiler/generator that would generate C code for my specific
regex but unfortunately I didn't find anything similar to what I
want.
Of course, I can do it the hard way by messing around with
the string functions in string.h but if I can avoid that I'll do
so.
Any suggestions are appreciated.
Thanks
Reiner