Am 9/9/2022 um 5:55 PM schrieb ykhab...@bellsouth.net:
Hello, I am using BaseX v.10.1 It seems that the current-dateTime() function precision is off. I am validating an XML file against an XSD 1.1 file via Xerces 2.12.2 validator. And trying to measure a timing of it. Here is my code. xquery version "4.0"; let $xml := '\\...\AForm-XSD-20211013\PD220224062681.XML' let $xsd := '\\...\AForm-XSD-20211013\Miami-ws-AForm.xsd' let $before_datetime := current-dateTime() let $result := validate:xsd-report($xml, $xsd, map { 'http://apache.org/xml/features/validation/cta-full-xpath-checking': true() }) return <root><metadata> <result>{data($result/status)}</result> <errors>{count($result/message)}</errors> <startTime>{$before_datetime}</startTime> <endTime>{current-dateTime()}</endTime> <xmlFile>{$xml}</xmlFile> <xsdFile>{$xsd}</xsdFile> <xsdProcessor>BaseX {data(db:system()//version)}, EE-Java, {validate:xsd-processor()} 2.12.2</xsdProcessor> <xsdVersion>{validate:xsd-version()}</xsdVersion> </metadata> <messages>{$result/message}</messages> </root> It is emitting the following output: <root> <metadata> <result>invalid</result> <errors>3</errors> <startTime>2022-09-09T11:32:29.667-04:00</startTime> <endTime>2022-09-09T11:32:29.667-04:00</endTime> <xmlFile>\\...\AForm-XSD-20211013\PD220224062681.XML</xmlFile> <xsdFile>\\...\AForm-XSD-20211013\Miami-ws-AForm.xsd</xsdFile> <xsdProcessor>BaseX 10.1, EE-Java, Xerces 2.12.2</xsdProcessor> <xsdVersion>1.1</xsdVersion> </metadata> <messages> ... </messages> </root> The question is why the before and after timing is the same: <startTime>2022-09-09T11:32:29.667-04:00</startTime> <endTime>2022-09-09T11:32:29.667-04:00</endTime> They are identical up to a millisecond.
I think, due to the functional/declarative language that is XQuery, the static context defines that current-dateTime() doesn't change during the execution of a single query, it is part of the static context. Most processors have extensions for timestamp and/or profiling, e.g. Saxon has saxon:timestamp(), I would think that BaseX also has some extension.