diff --git a/tools/python/xen/xend/XendAPI.py b/tools/python/xen/xend/XendAPI.py index 9b03ff9be2..89f0265f8b 100644 --- a/tools/python/xen/xend/XendAPI.py +++ b/tools/python/xen/xend/XendAPI.py @@ -96,7 +96,10 @@ def datetime(when = None): @param when The time in question, given as seconds since the epoch, UTC. May be None, in which case the current time is used. """ - return xmlrpclib.DateTime(time.gmtime(when)) + if when is None: + return xmlrpclib.DateTime(time.gmtime()) + else: + return xmlrpclib.DateTime(time.gmtime(when)) # ---------------------------------------------------