Ah, I love time questions. Everyone thinks time is a simple concept...

Let's look at this more closely. There are two distinct things here, being 
referred to as "the time".

There's the time. And there's how the time is displayed. The timezone 
determines the conversion between them.

I don't know what the user has done, exactly. He'll either have changed his 
time zone setting (which won't affect the actual time) or he'll have done 
something else, causing it to have the wrong time but display as he wants 
it. Let's hope it's the former; lying about time is not healthy -- and you 
shouldn't try to work around it.

Sunset really doesn't have anything to do with time zones. To compute the 
time of sunset, you need to know where you are -- latitude and longitude. If 
you're using timezone somehow in your calculation, you're doing it wrong. 
And yes, it involves latitude as well as longitude -- and time.

There's a lot of ways to calculate it, and some rough approximations might 
use timezone. If so, that's probably the source of your problem.

Once you have the time, then you need to display it -- and that's where the 
timezone setting comes in. That should work then just like any other time 
display,  using the default time zone.

But here's the key point -- you should never care, ever, about "the timezone 
of the current location". That is either the system's responsibility, or the 
user's. There are only three independent concepts at work here -- the 
current location, the current time, usually expressed in UTC, and the 
timezone in effect (for time display to the user).

The only time to worry about other time zones than the "currently selected" 
one, is when you're displaying time information for specified locations -- 
for example, for a World Clock application.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to