MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlSchemaDateNormalize

Function xmlSchemaDateNormalize

ThirdParty/libxml2/vtklibxml2/xmlschemastypes.c:4065–4092  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

4063 * Returns a normalized copy of @dt or NULL if error.
4064 */
4065static xmlSchemaValPtr
4066xmlSchemaDateNormalize (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:

Callers 2

xmlSchemaCompareDatesFunction · 0.85
xmlSchemaGetCanonValueFunction · 0.85

Calls 4

xmlSchemaDupValFunction · 0.85
xmlSchemaNewValueFunction · 0.85
_xmlSchemaDateAddFunction · 0.85
xmlSchemaFreeValueFunction · 0.85

Tested by

no test coverage detected