This works in the simulator, but on the real Fenix 7X localMoment returns null:
// get tz / dst for position _timeOffsetSecs = 0; myPosition = new Position.Location({:latitude=>myLat, :longitude=>myLong, :format=>:radians}); switch (_useLocalTime) { case true: { var myMoment = new Time.Moment(Time.now().value()); var myLocal = Gregorian.localMoment(myPosition, myMoment); if (myLocal != null) { _timeOffsetSecs = myLocal.getOffset(); break; } else { System.println("myPosition is " + ((myPosition != null) ? myPosition.toDegrees() : "null")); System.println("myMoment is " + ((myMoment != null) ? myMoment.value() : "null")); System.println("myLocal is null"); } } default: { var cTime = System.getClockTime(); _timeOffsetSecs = cTime.timeZoneOffset; } }
Output into log file on actual Fenix 7X is this:
myPosition is [30.332249, -87.141423] //Edit: position moved slighty from my house myMoment is 1691620268 myLocal is null
The documentation says if it returns null there was an error, and if it said "good luck with that" it would be more helpful than what's there now. Can someone offer any clues?