@@ -746,10 +746,10 @@ long long dateToGPSEpoch(uint8_t day, uint8_t month, uint16_t year)
746746}
747747
748748// Given an epoch, set the GPSWeek and GPSToW
749- void unixEpochToWeekToW (long long unixEpoch , uint16_t *GPSWeek, uint32_t *GPSToW)
749+ void epochToWeekToW (long long epoch , uint16_t *GPSWeek, uint32_t *GPSToW)
750750{
751- *GPSWeek = (uint16_t )(unixEpoch / (7 * 24 * 60 * 60 ));
752- *GPSToW = (uint32_t )(unixEpoch % (7 * 24 * 60 * 60 ));
751+ *GPSWeek = (uint16_t )(epoch / (7 * 24 * 60 * 60 ));
752+ *GPSToW = (uint32_t )(epoch % (7 * 24 * 60 * 60 ));
753753}
754754
755755// Given an epoch, set the GPSWeek and GPSToW
@@ -813,6 +813,8 @@ void dateToKeyStartDuration(uint8_t expDay, uint8_t expMonth, uint16_t expYear,
813813 long long gpsEpoch = thingstreamEpochToGPSEpoch (*settingsKeyStart);
814814
815815 if (ENABLE_DEVELOPER)
816+ epochToWeekToW (gpsEpoch, &keyGPSWeek, &keyGPSToW);
817+
816818 {
817819 systemPrintf (" KeyStart: %lld\r\n " , *settingsKeyStart);
818820 systemPrintf (" KeyDuration: %lld\r\n " , *settingsKeyDuration);
@@ -914,10 +916,12 @@ void pointperfectApplyKeys()
914916 uint16_t currentKeyGPSWeek;
915917 uint32_t currentKeyGPSToW;
916918 long long epoch = thingstreamEpochToGPSEpoch (settings.pointPerfectCurrentKeyStart );
919+ epochToWeekToW (epoch, ¤tKeyGPSWeek, ¤tKeyGPSToW);
917920
918921 uint16_t nextKeyGPSWeek;
919922 uint32_t nextKeyGPSToW;
920923 epoch = thingstreamEpochToGPSEpoch (settings.pointPerfectNextKeyStart );
924+ epochToWeekToW (epoch, &nextKeyGPSWeek, &nextKeyGPSToW);
921925
922926 theGNSS.setVal8 (UBLOX_CFG_SPARTN_USE_SOURCE, 1 ); // use LBAND PMP message
923927
0 commit comments