aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Varghese2013-09-25 11:40:58 (EDT)
committerRoy Varghese2013-09-25 11:40:58 (EDT)
commitb44c927c2707266e6b027818a5ef1df7d29dd71d (patch)
treed1dbddae3911635c7150fc52ef41bffe081c7acf
parentc78fb57e0ab6c3d6986139a6cdac7ad337b08615 (diff)
downloadorg.eclipse.hudson.core-b44c927c2707266e6b027818a5ef1df7d29dd71d.zip
org.eclipse.hudson.core-b44c927c2707266e6b027818a5ef1df7d29dd71d.tar.gz
org.eclipse.hudson.core-b44c927c2707266e6b027818a5ef1df7d29dd71d.tar.bz2
Fixed issue with Timestamp not displaying in Build History page.refs/changes/68/16768/1
The cached lightweight object for a build did not have this field. Signed-off-by: Roy Varghese <rovarghe@gmail.com>
-rw-r--r--hudson-core/src/main/java/hudson/model/BuildHistory.java3
-rw-r--r--hudson-core/src/main/java/hudson/model/Run.java8
-rw-r--r--hudson-core/src/main/java/hudson/model/RunMap.java10
3 files changed, 21 insertions, 0 deletions
diff --git a/hudson-core/src/main/java/hudson/model/BuildHistory.java b/hudson-core/src/main/java/hudson/model/BuildHistory.java
index b042e7e..b71ddd2 100644
--- a/hudson-core/src/main/java/hudson/model/BuildHistory.java
+++ b/hudson-core/src/main/java/hudson/model/BuildHistory.java
@@ -58,6 +58,9 @@ public interface BuildHistory<JobT extends Job<JobT, RunT>, RunT extends Run<Job
long getTimeInMillis();
Calendar getTimestamp();
+ String getTimestampString();
+ String getTimestampString2();
+
Date getTime();
long getDuration();
diff --git a/hudson-core/src/main/java/hudson/model/Run.java b/hudson-core/src/main/java/hudson/model/Run.java
index d21e27d..8c95e4e 100644
--- a/hudson-core/src/main/java/hudson/model/Run.java
+++ b/hudson-core/src/main/java/hudson/model/Run.java
@@ -583,6 +583,10 @@ public abstract class Run<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
* @return string like "3 minutes" "1 day" etc.
*/
public String getTimestampString() {
+ return getTimestampString(timestamp);
+ }
+
+ final static String getTimestampString(long timestamp) {
long duration = new GregorianCalendar().getTimeInMillis() - timestamp;
return Util.getPastTimeString(duration);
}
@@ -591,6 +595,10 @@ public abstract class Run<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
* Returns the timestamp formatted in xs:dateTime.
*/
public String getTimestampString2() {
+ return getTimestampString2(timestamp);
+ }
+
+ final static String getTimestampString2(long timestamp) {
return Util.XS_DATETIME_FORMATTER.format(new Date(timestamp));
}
diff --git a/hudson-core/src/main/java/hudson/model/RunMap.java b/hudson-core/src/main/java/hudson/model/RunMap.java
index 3e8bcee..98296d8 100644
--- a/hudson-core/src/main/java/hudson/model/RunMap.java
+++ b/hudson-core/src/main/java/hudson/model/RunMap.java
@@ -1005,6 +1005,16 @@ public final class RunMap<J extends Job<J, R>, R extends Run<J, R>>
}
@Override
+ public String getTimestampString() {
+ return Run.getTimestampString(getTimeInMillis());
+ }
+
+ @Override
+ public String getTimestampString2() {
+ return Run.getTimestampString2(getTimeInMillis());
+ }
+
+ @Override
public Date getTime() {
return new Date(getTimeInMillis());
}