From 4e0fc1b36986bca6cf6dd936371882ae28c9f5e4 Mon Sep 17 00:00:00 2001 From: Stephane Bailliez Date: Wed, 14 Aug 2002 23:13:05 +0000 Subject: [PATCH] The date format seems to be in 24h format (did not have time to browse all docs but this is what I get on my machine so far) though it is clear that unlike all cvs commands the timezone is in UTC so I added an additional setup to configure the format with the utc timezone. The hour format has been changed from hh to HH to accomodate 24h. PR: 11582 Reported by: m.mehrmann@fernuni-hagen.de (Mathias Mehrmann) git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273224 13f79535-47bb-0310-9956-ffa450edef68 --- .../tools/ant/taskdefs/cvslib/ChangeLogParser.java | 11 +++++++---- .../tools/ant/taskdefs/cvslib/ChangeLogWriter.java | 8 +++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java b/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java index 47e496782..a30bb6173 100644 --- a/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java +++ b/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java @@ -55,9 +55,7 @@ package org.apache.tools.ant.taskdefs.cvslib; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Enumeration; -import java.util.Hashtable; +import java.util.*; /** * A class used to parse the output of the CVS log command. @@ -75,7 +73,12 @@ class ChangeLogParser { /** input format for dates read in from cvs log */ private static final SimpleDateFormat c_inputDate - = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss"); + = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); + + static { + TimeZone utc = TimeZone.getTimeZone("UTC"); + c_inputDate.setTimeZone(utc); + } //The following is data used while processing stdout of CVS command private String m_file; diff --git a/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriter.java b/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriter.java index b3715482b..64f5b190c 100644 --- a/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriter.java +++ b/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriter.java @@ -56,6 +56,7 @@ package org.apache.tools.ant.taskdefs.cvslib; import java.io.PrintWriter; import java.text.SimpleDateFormat; import java.util.Enumeration; +import java.util.TimeZone; /** * Class used to generate an XML changelog. @@ -69,8 +70,13 @@ class ChangeLogWriter { = new SimpleDateFormat("yyyy-MM-dd"); /** output format for times writtn to xml file */ private static final SimpleDateFormat c_outputTime - = new SimpleDateFormat("hh:mm"); + = new SimpleDateFormat("HH:mm"); + static { + TimeZone utc = TimeZone.getTimeZone("UTC"); + c_outputDate.setTimeZone(utc); + c_outputTime.setTimeZone(utc); + } /** * Print out the specifed entrys.