Richard
Richard

Reputation: 1177

How can i reliably determine the time in Android?

I wrote an app to show the next stops of busses and trams at a given station in my city.

The data i am displaying is fetched from an online XML API and contains the absolute time of departures. Currently i am displaying this data as is (e.g. "11:53").

However some users wish to see the time in a relative format (e.g. "in 5 min").

Now the problem: Quite a few users i know have a constant offset in their system time. Sometimes even deliberately to avoid being late all the time. Most of the time they know this offset and consider it unconsciously when seeing an absolute time.

When i display the departure time relative to the system time however i doubt that users will consider their offset.

Is there a standard way to get the cell-network time for example? Should i just ignore the issue maybe?

Upvotes: 0

Views: 46

Answers (1)

VicX
VicX

Reputation: 711

When your app started, you can fetch the current time from some online service and compute this offset.

Upvotes: 1

Related Questions