File: cvslognewformat.patch

package info (click to toggle)
statcvs 20030713-4
  • links: PTS
  • area: contrib
  • in suites: etch, etch-m68k, sarge
  • size: 1,448 kB
  • ctags: 8
  • sloc: makefile: 108; sh: 12
file content (33 lines) | stat: -rw-r--r-- 1,223 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--- statcvs-20030713/src/net/sf/statcvs/util/DateUtils.java      2003-04-13 17:04:49.000000000 -0600
+++ statcvs-20030713/src/net/sf/statcvs/util/DateUtils.java      2004-08-16 13:16:33.000000000 -0600
@@ -38,10 +38,14 @@
 public class DateUtils {
	private static final String LOG_TIMESTAMP_FORMAT =
		"yyyy/MM/dd HH:mm:ss zzz";
+	private static final String LOG_TIMESTAMP_FORMAT_NEW =
+		"yyyy-MM-dd HH:mm:ss Z zzz";
	private static final Locale LOG_TIMESTAMP_LOCALE = Locale.US;

	private static SimpleDateFormat logTimeFormat =
		new SimpleDateFormat(LOG_TIMESTAMP_FORMAT, LOG_TIMESTAMP_LOCALE);
+	private static SimpleDateFormat logTimeFormatNew =
+		new SimpleDateFormat(LOG_TIMESTAMP_FORMAT_NEW, LOG_TIMESTAMP_LOCALE);
	private static SimpleDateFormat outputDateFormat =
		new SimpleDateFormat(Messages.getString("DATE_FORMAT"));
	private static SimpleDateFormat outputDateTimeFormat =
@@ -81,10 +85,13 @@
	*/
	public static Date convertFromLogTime(String modTime) {
		try {
+			if (modTime.indexOf('-') > 0)
+				return logTimeFormatNew.parse(modTime);
+
			return logTimeFormat.parse(modTime);
		} catch (ParseException e) {
			// fallback is to return null
			return null;
		}
	}
-}
\ No newline at end of file
+}