 
 void newFile(){
 
-    char newName[] = "SHIT";
-    strcat(newName, ".csv");
+    char *temp = (char*)malloc(sizeof(char)*NAME_LENGTH);
+
+    memcpy(temp, readTime(), sizeof(char)*NAME_LENGTH);
+
+    strcat(temp, ".csv");
+    filename = temp;
+#if TEST
+    return;
+#endif
     
+    /*
     TGC_logfile.close();
     TGC_logfile = SD.open(newName, FILE_WRITE);
 

        TGC_logfile.print("Created: ");
        TGC_logfile.println(newName);
    }
}

void standby(){

// the logging file
File TGC_logfile;

float* readVoltage(){
    static float voltages[4] = {0, 1, 0, 0};
    #if TEST
        Serial.println("readVoltage");
        for(int i=0; i<NUM_SOURCES; i++){
            voltages[i] = 13.8+i;
        }
        //return voltages;
    #endif

    for(int i=0; i<NUM_SOURCES; i++){
        voltages[i] =  analogRead(VOLT_PIN[i]) * VOLT_MULTI[i];
    }
    return voltages;
}//readVoltage

float* readAmp(){
    static float amps[4] = {0,0,0,0};
    #if TEST
        Serial.println("readAmp");
        for(int i=0; i<NUM_SOURCES; i++){
            amps[i] = 5.4+i;
        }
        //return amps;
    #endif

    for(int i=0; i<NUM_SOURCES; i++){
        amps[i] =  analogRead(AMP_PIN[i]) * AMP_MULTI[i];
    }
    return amps;
}//readAmp

float* readTemp(){
    static float temps[3] = {0,0,0};
    #if TEST
        Serial.println("readTemp");
        for(int i=0; i<NUM_SOURCES; i++){
            temps[i] = 20.3+i;
        }
        return temps;
    #endif

    for(int i=0; i<NUM_TEMPS; i++){
        //do something
    }
    return temps;
}//readTemp

char* readTime(){
    // TO DO
    static char *time;
    #if TEST
        Serial.println("readTime");
    #endif
        int randNumber = random(10);
        time = "2017_09_30-12-43-3";

        //strcat(time, str(randNumber));

    return time;
}//readTime

int writeSD(float volt[], float amp[], float temp[], char time[], float power){
    // TO DO
