[XForms] NPOTDB Microseconds not normalized when they need to be. Bug 412997, p=msterlin r=doronr+aaronr
git-svn-id: svn://10.0.0.236/trunk@248619 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -2409,7 +2409,8 @@ nsSchemaValidator::ValidateBuiltinTypeTime(const nsAString & aValue,
|
||||
sprintf(fulldate, "22-AUG-1993 %d:%d:%d.%u", time.hour, time.minute,
|
||||
time.second, time.millisecond);
|
||||
|
||||
PR_ParseTimeString(fulldate, PR_TRUE, aResult);
|
||||
PRBool isGMT = nsSchemaValidatorUtils::IsGMT(aValue);
|
||||
PR_ParseTimeString(fulldate, isGMT ? PR_TRUE : PR_FALSE, aResult);
|
||||
} else {
|
||||
*aResult = nsnull;
|
||||
rv = NS_ERROR_ILLEGAL_VALUE;
|
||||
@@ -2535,7 +2536,8 @@ nsSchemaValidator::ValidateBuiltinTypeDate(const nsAString & aValue,
|
||||
sprintf(fulldate, "%d-%s-%u 00:00:00", date.day,
|
||||
monthShorthand.get(), date.year);
|
||||
|
||||
PR_ParseTimeString(fulldate, PR_TRUE, aResult);
|
||||
PRBool isGMT = nsSchemaValidatorUtils::IsGMT(aValue);
|
||||
PR_ParseTimeString(fulldate, isGMT ? PR_TRUE : PR_FALSE, aResult);
|
||||
} else {
|
||||
*aResult = nsnull;
|
||||
rv = NS_ERROR_ILLEGAL_VALUE;
|
||||
@@ -2622,7 +2624,8 @@ nsSchemaValidator::ValidateBuiltinTypeDateTime(const nsAString & aValue,
|
||||
dateTime.time.second,
|
||||
dateTime.time.millisecond);
|
||||
|
||||
PR_ParseTimeString(fulldate, PR_TRUE, aResult);
|
||||
PRBool isGMT = nsSchemaValidatorUtils::IsGMT(aValue);
|
||||
PR_ParseTimeString(fulldate, isGMT ? PR_TRUE : PR_FALSE, aResult);
|
||||
} else {
|
||||
*aResult = nsnull;
|
||||
rv = NS_ERROR_ILLEGAL_VALUE;
|
||||
|
||||
@@ -2012,3 +2012,16 @@ nsSchemaValidatorUtils::FindCharInSet(const nsAString & aString,
|
||||
return kNotFound;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsSchemaValidatorUtils::IsGMT(const nsAString & aDateTime)
|
||||
{
|
||||
if (!aDateTime.IsEmpty()) {
|
||||
PRInt32 end = aDateTime.Length() - 1;
|
||||
PRUnichar c = aDateTime.CharAt(end);
|
||||
if (c == 'Z') {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
@@ -243,6 +243,13 @@ public:
|
||||
static void SetToNullOrElement(nsIDOMNode *aNode, nsIDOMNode **aResultNode);
|
||||
static PRInt32 FindCharInSet(const nsAString & aString, const char *aSet,
|
||||
PRInt32 aOffset = 0);
|
||||
/**
|
||||
* Determine if an xsd:date, xsd:dateTime, or xsd:time string
|
||||
* represents a GMT (aka UTC) time. This function assumes the
|
||||
* aDateTime string has already been validated.
|
||||
*/
|
||||
static PRBool IsGMT(const nsAString & aDateTime);
|
||||
|
||||
private:
|
||||
nsSchemaValidatorUtils();
|
||||
~nsSchemaValidatorUtils();
|
||||
|
||||
Reference in New Issue
Block a user