|
|
|
|
|
|
|
|
|
|
xen-api
RE: [Xen-API] [PATCH] Add function to Date module to assert ISO 8601 dat
Ah, thanks for making me aware of that :)
I have attached a new version of the patch.
I now have the function like this:
let assert_utc x =
try
Scanf.sscanf x "%_[0-9]T%_[0-9]:%_[0-9]:%_[0-9]Z" ()
with _ -> invalid_arg x
I think that should do what I wanted.
Cheers,
Rob
> -----Original Message-----
> From: Anil Madhavapeddy [mailto:anil@xxxxxxxxxx]
> Sent: 01 September 2010 17:25
> To: Dave Scott
> Cc: Rob Hoes; xen-api
> Subject: Re: [Xen-API] [PATCH] Add function to Date module to assert
> ISO 8601 datetime values are UTC
>
> Bits of it aren't threadsafe (although this use might be), but in
> general it definitely isnt. You could replace this use with a
> Scanf.sscanf easily enough I think?
>
> -anil
>
> On 1 Sep 2010, at 17:22, Dave Scott wrote:
>
> > Hi Rob,
> >
> > Is the Str module threadsafe? ISTR there was something dodgy about it
> in a threaded environment.
> >
> >> +let assert_utc x =
> >> + let r = Str.regexp "^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]T[0-
> >> 9][0-9]:[0-9][0-9]:[0-9][0-9]Z$" in
> >> + if not (Str.string_match r x 0) then
> >> + invalid_arg x
> >> +
> >
> >
> > Cheers,
> > Dave
> >
> > _______________________________________________
> > xen-api mailing list
> > xen-api@xxxxxxxxxxxxxxxxxxx
> > http://lists.xensource.com/mailman/listinfo/xen-api
> >
date-assert-utc
Description: date-assert-utc
_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
|
|
|
|
|