combine other people program, Could someone to help me in the right direction?

l want to build an environmental data logger, Longtime to monitor some thing.
I am not programmer, and I don’t learn about program. I am try my best to combine the program.

Adafruit Data Logger Shield
DHT11

I find the SD card Temp & Humidity datalogger library
https://raw.github.com/tigoe/DataloggingExamples/master/SDCardDataLogger/SDCardDataLogger.ino
and the SD card , real time clock and vcc sensor library

my combine program code, I test the program is work but the real time clock data is error and not work.
Can someone help me to find out problem ? Thanks

#include <SD.h>
#include "DHT.h"
#include <Wire.h>
#include "RTClib.h"

#define LOG_INTERVAL  1000 
#define SYNC_INTERVAL 1000 // mills between calls to flush() - to write data to the card
uint32_t syncTime = 0; // time of last sync()

#define ECHO_TO_SERIAL   1 // echo data to serial port
#define WAIT_TO_START    0 // Wait for serial input in setup()

#define DHTPIN 7        // what pin the sensor is connected to
#define DHTTYPE DHT11   // Which type of DHT sensor you're using: 

#define DHT_GND 5       // ground pin of the sensor
#define DHT_VCC 8       // voltage pin of the sensor

#define TEMPERATURE 1   //  for the DHT sensor
#define HUMIDITY 0      // for the DHT sensor
RTC_DS1307 RTC; 
// initialize the sensor:
DHT dht(DHTPIN, DHTTYPE);
const int interval = 10*1000; // the interval between reads, in ms
long lastReadTime = 0;        // the last time you read the sensor, in ms


// On the Ethernet Shield, CS is pin 4. Note that even if it's not
// used as the CS pin, the hardware CS pin (10 on most Arduino boards,
// 53 on the Mega) must be left as an output or the SD library
// functions will not work.
const int chipSelect = 10;

void setup() {
  Serial.begin(9600);
  if (startSDCard() == true) {
    startSensor(); 
  }
  // If you want to set the aref to something other than 5v
  analogReference(EXTERNAL);
}

void loop()
{
 // Get the current time in ms:
 long currentTime = millis();
 DateTime now;
     delay((LOG_INTERVAL -1) - (millis() % LOG_INTERVAL));
 
  if (currentTime > lastReadTime + interval) {
    float humidity = readSensor (HUMIDITY);
    float temperature = readSensor(TEMPERATURE);
    
    // open the file:
    File dataFile = SD.open("datalog.csv", FILE_WRITE);

  // log milliseconds since starting
  uint32_t m = millis();
  dataFile.print(m);           // milliseconds since start
  dataFile.print(", ");  
#if ECHO_TO_SERIAL
  Serial.print(m);         // milliseconds since start
  Serial.print(", ");  
#endif  
    // if the file is available, write to it:
    if (dataFile) {
      now = RTC.now();
      dataFile.print(now.unixtime()); // seconds since 1/1/1970      
      dataFile.print(", ");
      dataFile.print('"');
      dataFile.print(now.year(), DEC);
      dataFile.print("/");
      dataFile.print(now.month(), DEC);
      dataFile.print("/");
      dataFile.print(now.day(), DEC);
      dataFile.print(" ");
      dataFile.print(now.hour(), DEC);
      dataFile.print(":");
      dataFile.print(now.minute(), DEC);
      dataFile.print(":");
      dataFile.print(now.second(), DEC);
      dataFile.print('"');
      dataFile.print(humidity);
      dataFile.print("\t");
      dataFile.println(temperature);
      dataFile.close();
 #if ECHO_TO_SERIAL
      // print to the serial port too:
      Serial.print(now.unixtime()); // seconds since 1/1/1970
      Serial.print(", ");
      Serial.print('"');
      Serial.print(now.year(), DEC);
      Serial.print("/");
      Serial.print(now.month(), DEC);
      Serial.print("/");
      Serial.print(now.day(), DEC);
      Serial.print(" ");
      Serial.print(now.hour(), DEC);
      Serial.print(":");
      Serial.print(now.minute(), DEC);
      Serial.print(":");
      Serial.print(now.second(), DEC);
      Serial.print('"');
      Serial.print(humidity);
      Serial.print("\t");
      Serial.println(temperature);
      lastReadTime = millis();
#endif //ECHO_TO_SERIAL
  // Now we write data to disk! Don't sync too often - requires 2048 bytes of I/O to SD card
  // which uses a bunch of power and takes time
  if ((millis() - syncTime) < SYNC_INTERVAL) return;
  syncTime = millis();
  

    }  
    // if the file isn't open, pop up an error:
    else {
      Serial.println("error opening datalog.csv");
    } 
  }
}


boolean startSDCard() {
  boolean result = false;
  Serial.print("Initializing SD card...");
  // make sure that the default chip select pin is set to
  // output, even if you don't use it:
  pinMode(10, OUTPUT);

  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    result = false;
  } 
  else {
    Serial.println("card initialized.");
    File dataFile = SD.open("datalog.csv", FILE_WRITE);
    if (dataFile) {
      dataFile.println();
       dataFile.println("millis, stamp, datetime,rH (%), t temp. (*C)");
       Serial.println("millis, stamp, datetime,rH (%), t temp. (*C)");
      dataFile.close();
      result = true;
    }
  }  
  return result;
}


void startSensor() {
  // set up pins to power and read sensor:
  pinMode(DHT_VCC, OUTPUT);
  pinMode(DHT_GND, OUTPUT);
  digitalWrite(DHT_VCC, HIGH);
  digitalWrite(DHT_GND, LOW);
  // start sensor:
  dht.begin(); 
}

// get the sensor readings and concatenate them in a String:

float readSensor( int thisValue) {
  float result;

  if (thisValue == TEMPERATURE) {
    result = dht.readTemperature();
  } 
  else if (thisValue == HUMIDITY) {
    // read sensor:
    result = dht.readHumidity();   
  }
}

Maybe I missed it, but I don't see anywhere in your code where you initialized the DS1307, and input an initial time to it. It's only a realtime clock after it knows what time it is.

what is initialized the DS1307?