Skip to content

Commit 0a57d6a

Browse files
authored
Merge pull request #156 from xerial/local-timezone
Use local timezone strings for buildAtString
2 parents 0694272 + b8b7b61 commit 0a57d6a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

README.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ buildInfoOptions += BuildInfoOption.BuildTime
159159
to add timestamp values:
160160

161161
```scala
162-
/** The value is "2015-07-30 03:30:16.849". */
163-
val builtAtString: String = "2015-07-30 03:30:16.849"
162+
/** The value is "2015-07-30 03:30:16.849-0700". */
163+
val builtAtString: String = "2015-07-30 03:30:16.849-0700"
164164
/** The value is 1438227016849L. */
165165
val builtAtMillis: Long = 1438227016849L
166166
```

src/main/scala/sbtbuildinfo/BuildInfo.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ object BuildInfo {
1313
private def extraKeys(options: Seq[BuildInfoOption]): Seq[BuildInfoKey] =
1414
if (options contains BuildInfoOption.BuildTime) {
1515
val now = System.currentTimeMillis()
16-
val dtf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")
17-
dtf.setTimeZone(java.util.TimeZone.getTimeZone("UTC"))
16+
// Output the build time with the local timezone suffix
17+
val dtf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ")
1818
val nowStr = dtf.format(new java.util.Date(now))
1919
Seq[BuildInfoKey](
2020
"builtAtString" -> nowStr,

0 commit comments

Comments
 (0)