Re: Proposal: Clarification of DateFormat 'S' field

"Mark Davis" <[email protected]> Wed, 10 Mar 2004 18:18:48 -0800
Newsgroups gmane.comp.lib.icu.general
Message-ID <009c01c4070f$302bfeb0$70433409@DAVIS1>
The proposal is good, but I think they do need rounding; I would go with your
recommendation, simple HALF_UP. Your example should also show what happens with
trailing zeros.

Mark
__________________________________
http://www.macchiato.com
► शिष्यादिच्छेत्पराजयम् ◄

----- Original Message ----- 
From: "Alan S Liu" <[email protected]>
To: <[email protected]>
Sent: Wed, 2004 Mar 10 17:44
Subject: Proposal: Clarification of DateFormat 'S' field


> Proposal:  Change semantics of 'S' from "milliseconds" to "fractions of a
> second."
>
> This will make the 'S' field more generally useful in patterns such as
> "hh:mm:ss.S" immediately, and will allow for any future changes in which
> time representation is changed from having millisecond resolution.
>
> Currently the 'S' field in DateFormat is defined to display milliseconds.
> I would like to change this definition so that it displays fractions of a
> second.  That is, given the time 1:30:01.234567891, or 234,567,981 ns
> after 1:30:01, the following format behavior is proposed:
>
> ss.S => 01.2
> ss.SS => 01.23
> ss.SSS => 01.234
> ss.SSSS => 01.2345
> etc.
>
> The current proposal is to *truncate* the result with no rounding.  This
> conforms to the general policy in DateFormat in which fields are not
> rounded, but truncated.  E.g.,  hh:mm does not display "1:31" if the time
> is 1:30:59.  However, the case of fractions of a second is perhaps
> different, since it is a non-integral field.  An alternate proposal is to
> implement simple HALF_UP rounding.
>
> This will occur up to the limit of 1 nanosecond, that is, the maximum
> supported width is 9 characters: SSSSSSSSS.
>
> Note: This behavior is *partially* implemented in ICU4C already, and not
> implemented at all in ICU4J.
>
> Please reply with comments to this list.
>
> [Alan S Liu/San Jose/IBM@IBMUS; [email protected];; IBM Globalization;
> 5600 Cottle Road; San Jose, CA 95193;; (408) 256-3155]
> _______________________________________________
> icu mailing list
> [email protected]
> http://oss.software.ibm.com/developerworks/oss/mailman/listinfo/icu
>