   myRRD.resetFile();
   archiveRRD.resetFile();
   archiveRRD2.resetFile();
-
+ /*     
+ // Ethernet shield and NTP setup
+ int i = 0;
+ int DHCP = 0;
+ DHCP = Ethernet.begin(mac);
+ //Try to get dhcp settings 30 times before giving up
+ /*
+ while( DHCP == 0 && i < 30){
+   delay(1000);
+   DHCP = Ethernet.begin(mac);
+   i++;
+ }
+ */
+ /*
+ if(!DHCP){
+  Serial.println("DHCP FAILED");
+   for(;;); //Infinite loop because DHCP Failed
+ }
+ Serial.println("DHCP Success");
+ */
+ //Try to get the date and time
+/*
+ i=0;
+ while(!getTimeAndDate() && i<10) {
+   i++;
+ }
+*/
 }
 
 void loop()
 {
+  /*
+    // Update the time via NTP server as often as the time you set at the top
+  if(now()-ntpLastUpdate > ntpSyncTime) {
+    int trys=0;
+    while(!getTimeAndDate() && trys<10){
+      trys++;
+    }
+    if(trys<10){
+      //Serial.println("ntp server update success");
+    }
+    else{
+     // Serial.println("ntp server update failed");
+    }
+  }
+ */
+  // Display the time if it has changed by more than a second.
+  //if( now() != prevDisplay){
+    //prevDisplay = now();
+    //clockDisplay();  
+ // }
+        
   getTimestamp(&timestampBuffer[0]);
-  Serial.println(timestampBuffer);
+  //Serial.println(timestampBuffer);
   //Serial.print(F("freeMemory()="));Serial.println(freeMemory());
     boolean archive = myRRD.log("50",&timestampBuffer[0], &dataBuffer[0], &timestampBuffer[0]);
   if (archive){

   pinMode(10, OUTPUT);
   
  if (!SD.begin(4)) {
    Serial.println(F("initialization failed!"));
    return;
  }
  Serial.println(F("initialization done."));

  archiveRRD2 = RRDSD("testArc2.txt",4,12,22,2);
  archiveRRD = RRDSD("testArch.txt",2,4,22,2,&archiveRRD2,&average);

    //Serial.print(F("databuffer: ")); Serial.println(dataBuffer);
    //Serial.print(F("timestampbuffer: ")); Serial.println(timestampBuffer);
    archive = archiveRRD.log(&dataBuffer[0],&timestampBuffer[0], &dataBuffer[0], &timestampBuffer[0]);
    //Serial.print(F("freeMemory()="));Serial.println(freeMemory());
     if (archive){
       archiveRRD2.log(&dataBuffer[0],&timestampBuffer[0],&dataBuffer[0],&timestampBuffer[0]); 
     }
  }

  
  //Serial.print(F("freeMemory()="));Serial.println(freeMemory());
  
   myFile2 = SD.open("testArc2.txt");
  if(myFile2){
    while (myFile2.available()) {
