* xmlSchemaDateNormalize: * @dt: an #xmlSchemaValPtr of a date/time type value. * @offset: number of seconds to adjust @dt by. * * Normalize @dt to GMT time. The @offset parameter is subtracted from * the return value is a time-zone offset is present on @dt. * * Returns a normalized copy of @dt or NULL if error. */
| 4063 | * Returns a normalized copy of @dt or NULL if error. |
| 4064 | */ |
| 4065 | static xmlSchemaValPtr |
| 4066 | xmlSchemaDateNormalize (xmlSchemaValPtr dt, double offset) |
| 4067 | { |
| 4068 | xmlSchemaValPtr dur, ret; |
| 4069 | |
| 4070 | if (dt == NULL) |
| 4071 | return NULL; |
| 4072 | |
| 4073 | if (((dt->type != XML_SCHEMAS_TIME) && |
| 4074 | (dt->type != XML_SCHEMAS_DATETIME) && |
| 4075 | (dt->type != XML_SCHEMAS_DATE)) || (dt->value.date.tzo == 0)) |
| 4076 | return xmlSchemaDupVal(dt); |
| 4077 | |
| 4078 | dur = xmlSchemaNewValue(XML_SCHEMAS_DURATION); |
| 4079 | if (dur == NULL) |
| 4080 | return NULL; |
| 4081 | |
| 4082 | dur->value.date.sec -= offset; |
| 4083 | |
| 4084 | ret = _xmlSchemaDateAdd(dt, dur); |
| 4085 | if (ret == NULL) |
| 4086 | return NULL; |
| 4087 | |
| 4088 | xmlSchemaFreeValue(dur); |
| 4089 | |
| 4090 | /* ret->value.date.tzo = 0; */ |
| 4091 | return ret; |
| 4092 | } |
| 4093 | |
| 4094 | /** |
| 4095 | * _xmlSchemaDateCastYMToDays: |
no test coverage detected