From 465ee71e97935394f5aafbe32ae9b6f3f3ecb434 Mon Sep 17 00:00:00 2001 From: Sven de Marothy Date: Wed, 27 Apr 2005 20:47:40 +0200 Subject: [PATCH] 2005-04-27 Sven de Marothy * java/util/TimeZone.java, (getDefaultDisplayName): Fix previous fix. 2005-04-27 Sven de Marothy * java/util/TimeZone.java, (getDefaultDisplayName): Don't print zero offsets. From-SVN: r98874 --- libjava/ChangeLog | 10 ++++++++++ libjava/java/util/TimeZone.java | 20 +++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 35ab1d9..375b41d 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,13 @@ +2005-04-27 Sven de Marothy + + * java/util/TimeZone.java, + (getDefaultDisplayName): Fix previous fix. + +2005-04-27 Sven de Marothy + + * java/util/TimeZone.java, + (getDefaultDisplayName): Don't print zero offsets. + 2005-04-27 Roman Kennke * javax/swing/plaf/basic/BasicScrollBarUI diff --git a/libjava/java/util/TimeZone.java b/libjava/java/util/TimeZone.java index 7c81179..7b7947f 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(); } -- 2.7.4