Search code examples
c++datetimexsdtimezonegsoap

returning dateTime in local time instead of UTC with gSOAP


I have a soap server that uses gSOAP. One of the requests contain an xsd:dateTime field in the response. This dateTime is always returned in UTC, but I want to return the dateTime in local time. I fill the field with the local time as time_t, but then converting this into xsd:dateTime, gsoap converts it into UTC automatically. Can I change this behavior?

In this link it sounds like gsoap will always use UTC ("A time_t value is considered and represented in UTC by the serializer."). I also already searched through the flags here, but I could not find a flag for my use case.


Solution

  • In the implementation of the internal soap_dateTime2s function (as found here), it appears to test several config flags (settable in config.h).

    I haven't tested, but it would seem that to get output in terms of local time, HAVE_GMTIME_R and HAVE_GMTIME need to be undefined.