Feature Request: Time at a location and last known location

It would be nice to have a function where you could provide a set of coordinates to a function and return the time (moment or any other time format) for that location. Additionally seconding a past proposal for another function that would provide a set of coordinates for the last known good GPS reading (not power up the GPS).

This would go a long way to being able to provide a dual time zone function to a watch face for us timezone hoppers.

Right now I have a watch face that will try and determine your timezone the first time you start the app and save that off, but I have to make assumptions like being in the US, not living in Arizona. I find it very useful when traveling to have the local time and my home timezone available on the watch face instead of having to go through a widget.
  • Theoretically, you should be able to get last known position with Position.getInfo(). You'd want to check info.accuracy > Position.QUALITY_NOT_AVAILABLE before accessing info.position, but it should be there. I'm almost certain there is already a bug about this not working though.

    Travis
  • Travis,

    Thanks for the suggestion, been off on other things for a while, but getting back into this project.

    It does not appear that I can access any position information from within a watchface - am I mistaken? I keep getting "Permission Required" errors.

    Still trying to get to the goal of having a watchface that will show both the time in the timezone that you are in as well as the time at your home timezone. I have done one that shows UTM, SoF-UTM, but getting the home timezone time is a bit more challenging. Taking advantage of the timezone map and functions that the watch must have would make this far easier. :-)

    Paul
  • You can't use the Position module from a watch face. I believe there was some talk about letting the watch face have access to cached position data, which might help a little, but it won't solve your problems.

    Honestly, I don't think you can reliably detect the time zone from position given the current system. Time zones aren't simple longitudinal lines, and you have no access to data that describes the time zone in effect for a given position from a watch face. The Sys.ClockTime has a timeZoneOffset field which can tell you what time zone you are in (just the offset in seconds, not the zone name).

    You can get the current local time directly through Sys.getClockTime(). Once you have that, you can use the timeZoneOffset to get UTC time. At this point, things break down. If you want to get the time in the user's home time zone, you need the time zone rules for the zone (what month, day, hour, minute and second the transitions occur on as well as the transition offsets). The rules vary by country, and sometimes by region, so it isn't something that would make sense to guess at. If you want your application to work for the most people, you need to provide some way for the user to enter the time zone transition rules for their region.

    Travis