]> xenbits.xensource.com Git - xcp/xen-api-libs.git/commitdiff
CA-38687: be more accepting of ISO8601 dates without a timezone.
authorDavid Scott <dave.scott@eu.citrix.com>
Tue, 30 Mar 2010 10:30:33 +0000 (11:30 +0100)
committerDavid Scott <dave.scott@eu.citrix.com>
Tue, 30 Mar 2010 10:30:33 +0000 (11:30 +0100)
Note that xapi expects all dates to be in UTC; xapi knows nothing about timezones.

The XMLRPC spec is vague but encourages people to *omit* the timezone information from requests. We now accept such vague inputs but we still expect them to be in UTC.

The following python snippet produces no results without the fix and the full message list (as expected) with the fix:

<<<<<
#!/usr/bin/env python

import xmlrpclib

x = xmlrpclib.Server("http://localhost")
session = x.session.login_with_password("root", "password")["Value"]
print repr(x.message.get_since(session, xmlrpclib.DateTime(0)))
>>>>>

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
stdext/date.ml

index 0d411c5722f901f837ece39abf37378290740f03..71546b681e0dddd98cb75fc99455b44ccde2b58c 100644 (file)
@@ -41,7 +41,7 @@ let rfc822_to_string x = x
 
 (* Convert tm in localtime to calendar time, x *)
 let to_float_localtime x = 
-  Scanf.sscanf x "%04d%02d%02dT%02d:%02d:%02dZ"
+  Scanf.sscanf x "%04d%02d%02dT%02d:%02d:%02d"
     (fun y mon d h min s ->
        fst (Unix.mktime { Unix.tm_year = y - 1900;
                          tm_mon = mon - 1;