I'm accessing the iCloud API via python with pyiCloud.
When I pull my iPhone's GPS location with the API I get this:
>>> api.iphone.location()
{u'timeStamp': 1384188010186L, u'locationFinished': True, u'longitude': -0.14189, u'positionType': u'GPS', u'locationType': None, u'latitude': 51.501364, u'isOld': False, u'horizontalAccuracy': 5.0}
This is exactly the info I need. The issue I am having is figuring out how to convert that time stamp to something that makes sense. I'm confident that I have saw this time format before and converted it, but as of right now I can't figure it out.
I'd really like an explanation on this format, is it UTC or the ticks since 2000?
The format I am looking for something like: YYYYMMDD HH:MM:SS AM/PM
From here, it appears that the timestamp is in the US/Pacific-New timezone, and you'll need to divide it by 1000.
local_tz = pytz.timezone('US/Pacific-New')
date = datetime.datetime.fromtimestamp(
float(data['timeStamp']) / 1000,
local_tz
)