Duration and Period
I’m in the process or tidying up the bot behind
TorAtlas and I’ve chosen to write it in Java.
My undergraduate degree had a lot of Java in it, but that was while ago now,
and there are some cool new features I’ve learnt about including Period and
Duration.
Some of the tweets coming from the bot talk about how long a relay has been
contributing to the Tor network. When fetching the details
document I look at the
first_seen field and get this as a
ZonedDateTime
to make sure I’m doing all my calculations in UTC. I then use the between()
method on various ChronoUnits to work out how long between the first time the
relay was seen and now, and then I produced something human readable from this: