Skip to content

Commit

Permalink
JENKINS-51476: JGit retrieving revision number, fix zone
Browse files Browse the repository at this point in the history
  • Loading branch information
klimas7 committed May 24, 2018
1 parent 3398257 commit d840a83
Showing 1 changed file with 5 additions and 1 deletion.
@@ -1,5 +1,8 @@
package net.uaznia.lukanus.hudson.plugins.gitparameter;

import static java.lang.Long.parseLong;
import static org.joda.time.DateTimeZone.forID;

import hudson.plugins.git.GitException;
import hudson.plugins.git.Revision;
import org.apache.commons.lang.StringUtils;
Expand Down Expand Up @@ -65,7 +68,8 @@ private String prettyRevisionInfo(Revision revision) {
if (matcher.find()) {
String author = matcher.group(1);
String timestamp = matcher.group(2);
DateTime date = new DateTime(Long.parseLong(timestamp) * 1000); //Convert UNIX timestamp to date
String zone = matcher.group(3);
DateTime date = new DateTime(parseLong(timestamp) * 1000, forID(zone)); //Convert UNIX timestamp to date
return shortSha1 + " " + date.toString("yyyy-MM-dd HH:mm") + " " + author;
}

Expand Down

0 comments on commit d840a83

Please sign in to comment.