[kronolith] DateTime types in xml_rpc

Matthew Sackman matthew at sackman.co.uk
Sat Apr 19 18:43:24 PDT 2003


On Sat, Apr 19, 2003 at 05:53:06PM +0200, Jan Schneider wrote:
> Zitat von Matthew Sackman <matthew at sackman.co.uk>:
> > I'm trying to use the calendar.list function which takes startTime,
> > endTime, an array of calendars to check and the recurrance boolean. How
> > do I express the start and end dates? I'm using the dateTime.iso8601
> > format but it really isn't working:
> 
> It takes epoch timestamps iirc.

Well I'm now supplying that as ints:
<?xml version="1.0"?>
<methodCall>
<methodName>calendar.list</methodName>
<params>
<param><value><i4>946684800</i4></value></param>
<param><value><i4>1104537600</i4></value></param>
<param><value><array><data>
<value><string>test</string></value></data></array></value>
</param>
<param><value><boolean>1</boolean></value>
</param>
</params>
</methodCall>

But it doesn't produce any results (it should - there are events in the
calendar that should be reported back). Also, if I modify the function
listEvents in kronolith/lib/Kronolith.php to include
echo $startDate->year;
then there is no additional output. If I just echo $startDate then I get
the raw value out which must indicate that the date object(?) is not
being constructed. Thus the following code can't possibly work as
->year, ->month, ->mday are returning nulls:

        $startOfPeriodTimestamp = mktime(0, 0, 0, $startDate->month,
$startDate->mday, $startDate->year);
        $endOfPeriodTimestamp = mktime(23, 59, 59, $endDate->month,
$endDate->mday, $endDate->year);
        $daysInPeriod = Date_Calc::dateDiff($startDate->mday,
$startDate->month, $startDate->year, $endDate->mday, $endDate->month,
$endDate->year);

This code itself seems to be wanting to construct a timestamp and
refuses to when it finds it is already supplied with one. Unfortunately
I'm not anything like a good enough php programmer to try to produce a
working patch.

I've even tried passing a struct to see if there's a direct mapping of
the struct keys to the functions:
<param><value><struct>
<member><name>month</name><value><i4>1</i4></value></member>
<member><name>mday</name><value><i4>1</i4></value></member>
<member><name>year</name><value><i4>2005</i4></value></member>
</struct></value>
</param>

But still nothing comes out of $startDate->year.

Thanks,

Matthew
-- 
Matthew Sackman

BOFH excuse #373:
Suspicious pointer corrupted virtual machine


More information about the kronolith mailing list