Re: Proposal: Clarification of DateFormat 'S' field
Alan S Liu <[email protected]> Wed, 10 Mar 2004 17:59:33 -0800
| Newsgroups | gmane.comp.lib.icu.general |
|---|---|
| Message-ID | <OF67CB86A7.F6EAC1EF-ON88256E54.00098F40-88256E54.000AF22C@us.ibm.com> |
On further thought, I think the 'S' field should implement half-up rounding. [Alan S Liu/San Jose/IBM@IBMUS; [email protected];; IBM Globalization; 5600 Cottle Road; San Jose, CA 95193;; (408) 256-3155] __________________ 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]