     return NULL;
   }
 
-  /* Read data until either the connection is closed, or the idle timeout is reached. */ 
+  // try to read the Date line in the http headers
   char line[256];
   size_t pos = 0;
+  bool wehaveadate = 0;
   unsigned long lastRead = millis();
   while (www.connected() && (millis() - lastRead < IDLE_TIMEOUT_MS)) {
     while (www.available()) {

    }
  }
  www.close();
  Serial.println(F("-------------------------------------"));
  
}


            line[1] == 'a' &&
            line[2] == 't' &&
            line[3] == 'e' &&
            line[4] == ':') { // seriously? TODO: fix this shit
          wehaveadate = 1;
        }
      } else if (!wehaveadate) { // if we haven't reached a newline, put it in the buffer
        line[pos] = c;
        line[pos + 1] = 0;
        pos++;
