[Opendnssec-develop] libxml2 xsd:durations
John Dickinson
jad at jadickinson.co.uk
Wed Apr 15 09:40:52 UTC 2009
On 15 Apr 2009, at 09:59, Jelte Jansen wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> sion at nominet.org.uk wrote:
>>> Before I write a function to do it myself, does anyone know how to
>>> deal with xsd:durations in C (convert them to seconds). I hoped that
>>> libxml2 would do it for me but I can not find the function :)
>>
>> So there is some code in "enforcer/libksm/src/datetime.c" which takes
>> things like "2w" and converts it into 2 weeks worth of seconds.
>>
>> I can modify this to cope with xsd:durations in a simplified manner
>> (30
>> days in a month, 365 days in a year?)
>>
>> Would that be okay for version 1?
>>
>
> well that's what my python thing is doing at the moment too; as long
> as we
> document it I don't really mind. But is is something that should go
> on the todo
> list.
And my perl kaspimporter. But Perl being the only true language there
is at least a DateTime::Format::Duration::XSD module to help :)
BTW I think we should generate warnings whenever we convert months and
years to seconds.
---
John Dickinson
http://www.jadickinson.co.uk
I am riding from Lands end to John O'Groats to raise money for
Parkinson's Disease Research. Please sponsor me here http://justgiving.com/pedalforparkinsons2009
More information about the Opendnssec-develop
mailing list