axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Love <>
Subject Re: DateTime deserialization problems
Date Tue, 19 Sep 2006 03:01:16 GMT

It seems the code in Datetime::deserializeDateTime still makes use of 
time_t/localtime/mktime internally
to convert between formats. this might explain why you get an expcetion 
when trying to deserialize
the second date, as it is outside the range for a 32 bit time_t.

On another note with times/dates, I'm unable to deserialize the time 
1970-01-01T00:00:00Z, when my 
timezone is set to GMT+8.  The problem stems from the use of mktime, which 
takes into account timezones. 
In the following fragment of DateTime::deserializeDateTime(), the call to 
mktime() in the fails since it can't 
handle subtracting 8 hours from epoch time.  If I change my timezone to 
plain GMT+0, it works.
The code does attempt to take into account local timezones, but only if 
mktime() is successfull.

/*if the timezone is represented adding 'Z' at the end */
if ((cTemp = const_cast<char*>(strpbrk (valueAsChar, "Z"))) != NULL)
    time_t tempmktime = mktime (&value); // convert tm object to seconds 
// <--------- Fails here.
    if (tempmktime == -1)
        throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
    pTm = localtime (&tempmktime); // construct tm object from seconds
    memcpy (&value, pTm, sizeof (tm));
    time_t t = mktime (&value);
    if (t == -1)
      throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);

    t = labs (t - d); // Correct for local time zone. <--- We never get 
    pTm = localtime (&t);

As a workaround, I've simply commented out the body of the statement and 
just set "pTm" to "value" which
we get via the sscanf(). Does anyone have any suggestions how to go about 
deserializing such a datetime?

Kamlesh kumar <> wrote on 19/09/2006 03:07:59 AM:

> I am facing a strange problem with Date & DateTime
> deserialization. 
> Axis can successfully parse the following date
> <foo>2035-08-15-00:00</foo>
> However, its not able to parse this date.
> <foo>2038-08-15-00:00</foo>
> Note, the change is only in the year field. Instead it
> throws an exception saying 
> "AxisSoapException:Received content is faulty".
> Does anyone know why its failing ?
> I tried looking at existing JIRA issues and found this
> one
> However, it only mentions problem about dates prior to
> 1970 but nothing about dates after 2035.
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message