I am trying to understand why the following java.time.Clock
is returning UTC time instead of the local time zone (EST).
C:\Users\Felipe>scala
Welcome to Scala 2.12.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_65).
Type in expressions for evaluation. Or try :help.
scala> import java.time._
import java.time._
scala> ZoneId.systemDefault()
res0: java.time.ZoneId = America/New_York
scala> val clock = Clock.systemDefaultZone()
clock: java.time.Clock = SystemClock[America/New_York]
scala> clock.instant
res1: java.time.Instant = 2017-07-06T16:20:04.990Z
The current time when I ran the above was 12:20pm
(i.e. 4h before the UTC time shown)