[XForms] local-dateTime doesn't handle daylight savings time. Bug 487310, r=olli+msterlin

git-svn-id: svn://10.0.0.236/trunk@258343 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
aaronr%us.ibm.com 2009-09-09 23:59:08 +00:00
parent cec8714dc6
commit 500ad69487

View File

@ -2889,11 +2889,17 @@ nsXFormsUtils::GetTime(nsAString & aResult, PRBool aUTC)
return NS_OK; return NS_OK;
} }
int gmtoffsethour = time.tm_params.tp_gmt_offset < 0 ? int gmtoffsethour = time.tm_params.tp_gmt_offset / 3600;
-1*time.tm_params.tp_gmt_offset / 3600 :
time.tm_params.tp_gmt_offset / 3600;
int remainder = time.tm_params.tp_gmt_offset%3600; int remainder = time.tm_params.tp_gmt_offset%3600;
int gmtoffsetminute = remainder ? remainder/60 : 00; int gmtoffsetminute = remainder ? remainder/60 : 00;
// adjust gmtoffsethour for daylight savings time.
int dstoffset = time.tm_params.tp_dst_offset / 3600;
gmtoffsethour += dstoffset;
if (gmtoffsethour < 0) {
// Make the gmtoffsethour positive; we'll add the plus or minus
// to the time zone string.
gmtoffsethour *= -1;
}
char zone_location[40]; char zone_location[40];
const int zoneBufSize = sizeof(zone_location); const int zoneBufSize = sizeof(zone_location);