Email or username:

Password:

Forgot your password?
Top-level
Maksim Odnoletkov

@nikitonsky

- government removes daylight savings

- clock starts showing wrong time on an old Android device

- user fixes by adjusting system time manually

- now they have incorrect system time on their device (compensated by local tzdb error)

- you build mastodon client that shows relative times – i.e. 'posted 5 min ago'

- post time comes from server and is 'correct'

- how to render this relative time on such devices with 'incorrect' system time?

7 comments
Niki Tonsky

@odnoletkov well it’s still going to be correct, it doesn’t really matter what tz user uses

Maksim Odnoletkov

@nikitonsky to show relative time like that you need to compare local and remote times – that would not work when local time is way off

Niki Tonsky

@odnoletkov way off from what? It’s just local time!

Maksim Odnoletkov

@nikitonsky your `System.currentTimeMillis` is off by 1hr. You have `post.timestamp` which is correct. How do you render label like 'posted 5 min ago' properly?

Niki Tonsky

@odnoletkov No, System.currentTimeMillis is never off by an hour, regardless of timezone. In fact, it doesn’t even change when you change time zones

Maksim Odnoletkov

@nikitonsky see original scenario: "user fixes by adjusting system time manually"

Niki Tonsky

@odnoletkov Oh, yeah, but then HTTPS won’t work, so all good

Go Up