gSOAP 2.7.12
If dayTime is not in UTC or doesn't have time zone offset, local time zone
is assumed.
In s2dateTime, the following modification:
*p = mktime(T)
T.tm_isdst = -1;
is needed to make mktime() determine whether supplied time should be
interpreted with daylight savings time zone or not. Currently tm_isdst is
zeroed so DST is never assumed.
For example, the following tests work as expected after adding the fix:
cest_to_utc(void)
{
struct soap soap;
time_t t = 0;
struct tm *tm = NULL;
char tbuf[128] = "";
/* XXX: This test is specific to Poland and other countries that
use CET (+01:00) and CEST (+02:00). */
soap_init(&soap);
/* Summer time (CEST, +02:00) */
if (soap_s2dateTime(&soap, "2008-08-01T20:00:00", &t) != SOAP_OK)
{
soap_print_fault(&soap, stderr);
assert(0);
}
tm = gmtime(&t);
strftime(tbuf, sizeof(tbuf), "%F %H:%M %Z", tm);
printf("%u\n", (unsigned int) t);
printf("%s\n", tbuf);
assert(!strcmp(tbuf, "2008-08-01 18:00 GMT") || !strcmp(tbuf,
"2008-08-01 18:00 UTC") );
}
void
cet_to_utc(void)
{
struct soap soap;
time_t t = 0;
struct tm *tm = NULL;
char tbuf[128] = "";
/* XXX: This test is specific to Poland and other countries that
use CET (+01:00) and CEST (+02:00). */
soap_init(&soap);
/* Winter time (CET, +01:00) */
if (soap_s2dateTime(&soap, "2008-12-01T20:00:00", &t) != SOAP_OK)
{
soap_print_fault(&soap, stderr);
assert(0);
}
tm = gmtime(&t);
strftime(tbuf, sizeof(tbuf), "%F %H:%M %Z", tm);
printf("%u\n", (unsigned int) t);
printf("%s\n", tbuf);
assert(!strcmp(tbuf, "2008-12-01 19:00 GMT") || !strcmp(tbuf,
"2008-12-01 19:00 UTC") );
}
Robert van Engelen
None
None
Public
|
Date: 2009-03-02 03:43 Is fixed in the 2.7.13 release. |
| Field | Old Value | Date | By |
|---|---|---|---|
| status_id | Open | 2009-03-02 03:43 | engelen |
| resolution_id | None | 2009-03-02 03:43 | engelen |
| assigned_to | nobody | 2009-03-02 03:43 | engelen |
| allow_comments | 1 | 2009-03-02 03:43 | engelen |
| close_date | - | 2009-03-02 03:43 | engelen |