I have a data acquisition program running in an Ubuntu environment. When a data trigger is met, the program creates a new file containing the data, with the filename being a timestamp of when the trigger was met. Right now I'm generating a timestamp using ctime and the program works:
#include <time.h>
time_t rawtime; // Generating time stamp
time(&rawtime);
sprintf(buffer, "/usb/%s.txt", ctime(&rawtime));
A file is created named Fri_May_27_17_58_38_2022.txt
Is it possible to use the same method to get a more precise timestamp to milliseconds?