File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
tests/jvm-native/src/test/scala/cats/effect Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1616
1717package cats .effect
1818
19+ import java .time .ZoneOffset
20+
1921trait SyncIOPlatformSuite { self : BaseSuite =>
2022 def platformTests () = {
2123
@@ -30,6 +32,22 @@ trait SyncIOPlatformSuite { self: BaseSuite =>
3032 assertCompleteAsSync(op, true )
3133 }
3234
35+ testUnit(
36+ " realTimeZonedDateTime should return a ZonedDateTime constructed from realTime with UTC offset" ) {
37+
38+ // Unfortunately since SyncIO doesn't use on a controllable
39+ // clock source, so a diff best we can do
40+ val op = for {
41+ realTime <- SyncIO .realTime
42+ now <- SyncIO .realTimeZonedDateTime
43+ } yield (
44+ (now.toInstant.toEpochMilli - realTime.toMillis) <= 10000 ,
45+ now.getOffset.getTotalSeconds
46+ )
47+
48+ assertCompleteAsSync(op, (true , ZoneOffset .UTC .getTotalSeconds))
49+ }
50+
3351 }
3452
3553}
You can’t perform that action at this time.
0 commit comments