// Check which is earlier: the lastSync time returned from Bodymedia or the
// point we were in the update that just ended. Store the lesser of the two
// in nextUpdateStartDate
String nextUpdateStartDate = storedUpdateStartDate;
if (lastSync != null) {
if (comparator.compare(updateProgressTime, lastSync) > 0) {
// lastSync from Bodymedia is less than the update progress
nextUpdateStartDate = lastSync.toString(formatter);
}
else {
// the update progress is less than lastSync from Bodymedia