From 7a80cb08a6b7ffc369e838119457a0bec864c2af Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 8 Mar 2006 19:34:02 +0000 Subject: [PATCH] changed system.time for Espen/eGWOsync to return struct with keys: - system: system-time as datetime.iso8601 - system_tz_offset: tz_offset to UTC in seconds as integer and, if loged in, analog user and user_tz_offset --- phpgwapi/inc/xml_functions.inc.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/phpgwapi/inc/xml_functions.inc.php b/phpgwapi/inc/xml_functions.inc.php index 0f89acc8be..1bd76af154 100644 --- a/phpgwapi/inc/xml_functions.inc.php +++ b/phpgwapi/inc/xml_functions.inc.php @@ -928,17 +928,25 @@ } */ - $GLOBALS['_xmlrpcs_egw_time_sig'] = array(array(xmlrpcString,xmlrpcString)); - $GLOBALS['_xmlrpcs_egw_time_doc'] = 'Returns system time based on optional format string'; + $GLOBALS['_xmlrpcs_egw_time_sig'] = array(array(xmlrpcStruct)); + $GLOBALS['_xmlrpcs_egw_time_doc'] = 'returns system-time and -timezone and if loged in user-time and timezone'; function _xmlrpcs_time($server,$m) { - $param0 = $m->getParam(0); - $format = $param0->scalarval(); - $format = $format ? $format : 'Y/m/d H:i:s'; - + $return = array( + 'system' => $GLOBALS['server']->date2iso8601(time()), + 'system_tz_offset' => (int) date('Z'), + ); + if ($GLOBALS['server']->authed) + { + $tz_offset_s = 3600 * (int) $GLOBALS['egw_info']['user']['preferences']['common']['tz_offset']; + $return += array( + 'user' => $GLOBALS['server']->date2iso8601(time()+$tz_offset_s), + 'user_tz_offset' => (int) date('Z') + $tz_offset_s, + ); + } return CreateObject( 'phpgwapi.xmlrpcresp', - CreateObject('phpgwapi.xmlrpcval', date($format,time()), 'string') + $GLOBALS['server']->build_resp($return,true) ); }