Skip to content

Commit

Permalink
Fixed date formatting in UTC timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
cuuzis committed Jul 22, 2017
1 parent 78aa342 commit b246c9f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>it.unibz.inf</groupId>
<artifactId>sonar-history-scanner</artifactId>
<version>0.4.1</version>
<version>0.4.3</version>

<!-- https://kotlinlang.org/docs/reference/using-maven.html -->
<properties>
Expand Down
12 changes: 6 additions & 6 deletions src/main/kotlin/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,15 @@ fun checkoutFromCmd(logHash: String, git: Git) {
}

/*
Formats timestamp for using as a sonar-scanner parameter
*/
* Formats timestamp for using it as a sonar-scanner parameter
*/
fun getSonarDate(logDate: Instant): String {
val formatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME
.withLocale(Locale.getDefault())
.withLocale(Locale.ENGLISH)
.withZone(ZoneId.systemDefault())
val result = formatter.format(logDate)
.removeRange(22, 23) // removes colon from time zone (to post timestamp to sonarqube analysis)
return result
var dateStr = formatter.format(logDate)
dateStr = dateStr.replace("Z", "+00:00") // for UTC time zone
return dateStr.removeRange(22, 23) // removes colon from time zone (to post timestamp to sonarqube analysis)
}

/*
Expand Down

0 comments on commit b246c9f

Please sign in to comment.