W3C home > Mailing lists > Public > public-forms@w3.org > August 2008

Negative values should be returned from seconds-from-dateTime()

From: Mark Birbeck <mark.birbeck@webbackplane.com>
Date: Fri, 1 Aug 2008 13:54:34 +0100
Message-ID: <ed77aa9f0808010554s79fe15b9yf8d18f716bd40af5@mail.gmail.com>
To: public-forms <public-forms@w3.org>

Hello all,

I've been having a lot of fun :( trying to get the various date/time
functions working in the Ubiquity XForms library, and most of the
problems arise from timezone switching.

Anyway, one of the tests for seconds-from-dateTime() involves a
timezone, as follows:


This test is based on an example in section 7.9.6 of the XForms 1.1 spec.

My question is, why is the example saying that it should be a positive
number? It's true that the spec says:

  "...the return value is equal to the number of seconds difference..."

which would imply making the number positive -- so the result is
correct according to the spec. But I wonder what we gain by *losing*
the sign of the result.

The problem is further compounded when you use this function with the
complementary seconds-to-dateTime(). Nothing says that
seconds-to-dateTime() should _not_ take a negative value, so the
problem we have is that the following pair of calls does not give you
back what you started with:


I.e, the result according to the spec is 28800, when it could easily be -28800.

I think that the fix is to simply change the example in the spec,
which would send a clear signal to implementers:


  returns 0

  returns -28800

Note that the Ubiquity XForms unit tests for this are currently
passing because I've set the functions to return a negative number.
Obviously I'll change that if need be, but I'll see what points come
up on this discussion first.



Mark Birbeck, webBackplane



webBackplane is a trading name of Backplane Ltd. (company number
05972288, registered office: 2nd Floor, 69/85 Tabernacle Street,
London, EC2A 4RR)
Received on Friday, 1 August 2008 12:55:15 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:13:58 UTC