     }
     // Record when we took these readings
     time_t readingsTime = now();
+    batteryReadings[readingIdx].setTime(readingsTime);
+    chargingReadings[readingIdx].setTime(readingsTime);
+    sensorReadings[readingIdx].setTime(readingsTime);
 #if DEBUG
     LOG_SERIAL_PORT.println("Readings...");
     LOG_SERIAL_PORT.print("Time: ");

        // We've been given a time, so let's use it
        modem.setTime(timeToString(now()));
      }
#endif
    }
  }
  // Set the Time library time from the modem
  String modemTime = modem.getTime();
#if DEBUG
  LOG_SERIAL_PORT.print("The time is ");
  LOG_SERIAL_PORT.println(modemTime);
#endif
  setTimeFromModem(modemTime);
}

String timeToString(time_t aTime)

    digitalWrite(kActivityDetectedLED, HIGH);
    // Find out how long we've been active, and use that to guide
    // how many people we think have passed
    // But really short readings will be the sensor lying to us
    if (millis()-movementStart > 3300)
    {
      movementCount++;
      if (millis()-movementStart < 10*60*1000UL)
      {
        movementCount += (millis()-movementStart)/kPassingTime;
      }
      else
      {
        // it's over 10 minutes, reckon it's someone loitering
        // Probably at least two people then :-)
        movementCount++;
      }
    }    
  }
}
