2

The android's Location documentation states that it provides UTC. Is that UTC with or without leap seconds?

There are many questions regarding wether Java accounts for leap seconds, most of them leaning to say that it does not, ambiguous before java 7 and clearly afterwards.

However, getTime() relies on the gps time, which does not account for leap seconds. Does location add them? I doubt so but I would like to be sure and the documentation is unclear.

And moreover, does SimpleDateFormat account them when set to timeZone("UTC") ? (I know UTC is not a time zone, but apparenly TimeZone.getTimeZone("UTC") is valid)

A similar question is indirectly asked here: Ticks between Unix epoch and GPS epoch. Where it's proven that Date.getTime does not take into account UTC leap seconds. The question is, does Location.getTime also ignore them? I guess so, even thought the documentation states that it reports UTC, it can't (unless periodically updated) and most likely won't.

Community
  • 1
  • 1
quimnuss
  • 1,503
  • 2
  • 17
  • 37

1 Answers1

0

I am sure you will find this topic interesting

Android problem finding out how recent latest GPS fix is

But indeed this is not really detailed in the documentation...I am curious about this too :p

Community
  • 1
  • 1
Pclaverie
  • 164
  • 2
  • 17
  • 1
    I don't use the device's time for anything here. It's the fix time conversion that I wonder about, is it real UTC or is it UNIX Epoch (number of miliseconds since 1970 without leap seconds). The question you link disserts about the device time, which is a far more complicated issue. But thanks anyway! – quimnuss Jan 15 '16 at 12:58
  • This quiestion is more pertinent: http://stackoverflow.com/questions/20521750/ticks-between-unix-epoch-and-gps-epoch . Adding it to the question for clarification. – quimnuss Jan 15 '16 at 13:06
  • 1
    This is not really an answer. And the documentation states that getTime() shall `Return the UTC time of this fix, in milliseconds since January 1, 1970.` so it seems like nobody is actually adhering to the spec, which is unfortunate. – Michael Oct 13 '17 at 20:56