Skip to content

Commit

Permalink
Use fixed time zone for toString
Browse files Browse the repository at this point in the history
  • Loading branch information
xerial committed Jun 26, 2017
1 parent f0c4c39 commit b5415c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion wvlet-core/src/main/scala/wvlet/core/scales/TimeWindow.scala
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ object TimeWindow {

def withZone(zoneName:String): TimeWindowBuilder = {
import scala.collection.JavaConverters._
val idMap = ZoneId.SHORT_IDS.asScala ++ Map("PDT" -> "-07:00", "EDT" -> "-04:00", "CDT" -> "-05:00", "MDT" -> "-06:00")
// Add commonly used daylight saving times
val idMap = ZoneId.SHORT_IDS.asScala ++
Map("PDT" -> "-07:00", "EDT" -> "-04:00", "CDT" -> "-05:00", "MDT" -> "-06:00")
val zoneId = idMap
.get(zoneName)
.map(ZoneId.of(_))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import wvlet.test.WvletSpec
*/
class TimeWindowTest extends WvletSpec {

val t = TimeWindow.ofSystem.withCurrentTime("2016-06-26 01:23:45-0700")
val t = TimeWindow.withZone("PDT").withCurrentTime("2016-06-26 01:23:45-0700")
val zone = t.zone
info(s"now: ${t.now}")

Expand All @@ -27,7 +27,7 @@ class TimeWindowTest extends WvletSpec {
def parse(s:String, expected:String): TimeWindow = {
val w = t.parse(s)
info(s"str:${s}, window:${w}")
w.toString shouldBe expected
w.toStringAt(zone) shouldBe expected
w
}

Expand Down

0 comments on commit b5415c8

Please sign in to comment.