gaining accurate time on time sensitive measurements.

thanks for the reply... i've been messing with it but i have ran into a different snag...

my sketch seems to not be creating my data log file.... here is the code...

#include <SPI.h>
#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>
#include <SD.h>
#include <string.h>
#include <Adafruit_CC3000.h>
#include <ccspi.h>
//SoftwareSerial mySerial(8, 7);
//Adafruit_GPS GPS(&mySerial);
//#define chipSelect 10
int interval = 100;
unsigned long previousMillis=0;
unsigned long time=0;
File logfile;
long Vin;
void setup(){
  Serial.begin(9600);
  delay(1000);
  Serial.print("Finding the SD Card....");
  pinMode(10,OUTPUT);
  delay(1000);
  if (!SD.begin(10)) {
    Serial.println("Couldn't find it..... Sorry.");
    //return;
  }
  Serial.println("FOUNTD IT!!!!  Lets start recording.");
  File dataFile=SD.open("testfortime1",FILE_WRITE);
  if (dataFile){
    dataFile.print("TIME");
    dataFile.print(",");
    dataFile.println("SENSOR Q");
    dataFile.close();
  }
  int ref = analogRead(14);
  Vin = 1125300 / ref ; 
}
void loop() {
  unsigned long currentMillis = millis();
  if ((unsigned long)(currentMillis-previousMillis)>=interval) {
    long sensorQ = Vin * analogRead(0)* 500000;
    File dataFile=SD.open("testfortime1",FILE_WRITE);
    if(dataFile){
      dataFile.print(currentMillis);
      dataFile.print(",");
      dataFile.println(sensorQ);
      dataFile.close();
    }
    //Serial.print(time);
    //Serial.print(",");
    //Serial.println(currentMillis);
    previousMillis=currentMillis;
    //time=time+100;
  }
}

sorry for all the trouble and thanks for all the help