diff options
-rw-r--r-- | libjava/ChangeLog | 10 | ||||
-rw-r--r-- | libjava/java/util/TimeZone.java | 20 |
2 files changed, 23 insertions, 7 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 35ab1d92166..375b41dc46a 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,13 @@ +2005-04-27 Sven de Marothy <sven@physto.se> + + * java/util/TimeZone.java, + (getDefaultDisplayName): Fix previous fix. + +2005-04-27 Sven de Marothy <sven@physto.se> + + * java/util/TimeZone.java, + (getDefaultDisplayName): Don't print zero offsets. + 2005-04-27 Roman Kennke <roman@kennke.org> * javax/swing/plaf/basic/BasicScrollBarUI diff --git a/libjava/java/util/TimeZone.java b/libjava/java/util/TimeZone.java index 7c811795790..7b7947f63ca 100644 --- a/libjava/java/util/TimeZone.java +++ b/libjava/java/util/TimeZone.java @@ -1107,15 +1107,21 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable StringBuffer sb = new StringBuffer(9); sb.append("GMT"); - sb.append(offset >= 0 ? '+' : '-'); - offset = Math.abs(offset) / (1000 * 60); - int hours = offset / 60; - int minutes = offset % 60; + offset = offset / (1000 * 60); + int hours = Math.abs(offset) / 60; + int minutes = Math.abs(offset) % 60; + + if (minutes != 0 || hours != 0) + { + sb.append(offset >= 0 ? '+' : '-'); + sb.append((char) ('0' + hours / 10)); + sb.append((char) ('0' + hours % 10)); + sb.append(':'); + sb.append((char) ('0' + minutes / 10)); + sb.append((char) ('0' + minutes % 10)); + } - sb.append((char) ('0' + hours / 10)).append((char) ('0' + hours % 10)); - sb.append(':'); - sb.append((char) ('0' + minutes / 10)).append((char) ('0' + minutes % 10)); return sb.toString(); } |