I'm liking the new timeAPI for Monotonic and TestT...
# announcements
t
I'm liking the new timeAPI for Monotonic and TestTime. TimeMark is pretty awesome for most things where I mark time from a point. Only one slight issue. I have one place where I get a time given to me as a ZonedDateTime(instead of assuming now). Is there a way given a Clock and a ZonedDateTime to create a TimeMark?
i
I think you can make a
TimeSource
implementation, that wraps
Clock
and return time marks based on instants.
Something like:
t
I'm thinking the other way around though... I have a Timesource already that I'm using for a few periodic duration type activities.. Then I have a new places where the "time" is sent in via a String that I parse into a ZoneDateTime. I want to take that zoneDateTime and turn it into a TimeMark.
like
Copy code
val timeMark = ZoneDateTime.parse("2020-05-03T01:01:01Z").asTimeMark()
Copy code
val hasItBeenAMinute = tm.plus(1.minutes).hasPassedNow()
ohh.. wait.. lemme re-look at that
didnt see the
markAt's
in there.
yeah.. I think that'll work. Awesome!