caplcanoe

How do I get the current Time in CAPL?


I am writing testresults I get into an .csv now I want to get a new .csv when I repeat the test.

my idea was to set the Timestamp at the End of the name of my .csv to tell them appart but I cant figure out how to do that.

my code is as follows:

setFilePath("C:XXXX", 2);
logFile = openFileWrite("Results.csv", 2);

if (tf1succes == 1) 
{
  snprintf(results, 1024, "TF01 was succesfull. \n");
  filePutString(results, 1024, logFile);       
}
else
{
  snprintf(results, 1024, "TF01 was not succesfull. \n");
  filePutString(results, 1024, logFile);       
}

fileClose(logFile);

getTime() - didnt work

getSystemTime() - didnt work


Solution

  • For someone looking at this later: the solution is to use getLocalTimeString the right way.

    getLocalTimeString(timeactual);
    

    will fill the current time and date into your variable:

    char timeactual[27];