I have log data ranging from 1000 to 100000 entries all from different sources. The objective is to sort this data by time (quickly). I was prototyping in C and i'm stuck because it looks like tm doesn't support milliseconds. Am i missing something here ? Any suggestions ? 

Idea:

1. Open file. Parse line-by-line and tokenize fields to c struct via strtok

1.1 Convert Date & Time to "struct tm".

1.2 Build linked list
2. Sort linked list based on time (don't know which sort algorithm i'd use)
3. Output

[Example]

```none
YYYY-MM-DD,HH:MM:SS:MS , PID, TID , COMPONENT, Message 
2017-03-29,20:56:27:088, 3436,2568,COMPONENT, Message String blah blah
2017-03-29,20:56:27:089, 3436,2568,COMPONENT, Message String baaaaa
2017-03-29,20:56:27:079, 3436,2568,COMPONENT, Message String roarrr
2017-03-29,20:56:28:061, 3436,2568,COMPONENT, Message String meow
2017-03-29,20:56:25:044, 3436,2568,COMPONENT, Message String ruff ruff 
.
.
.
100000 entries 

```

---

```
const char T[] = "2017-03-29,20:56:27:088"; //Test String
time_t result = 0;
int year = 0, month = 0, day = 0;
int hour = 0, min = 0, sec = 0, ms = 0;

if (sscanf(T, "%4d-%2d-%2d,%2d:%2d:%2d", &year, &month, &day, &hour, &min, &sec) == 6) {
    struct tm tv = {0};
    tv.tm_year = year;
    tv.tm_mon = month;
    tv.tm_mday = day;
    tv.tm_hour = hour;
    tv.tm_min = min;
    tv.tm_sec = sec;
    //Crap, it doesn't look like tm handles milliseconds ????

    if ((result = mktime(&tv)) == (time_t)-1) {
        fprintf(stderr, "Conversion Error\n");
    }
    puts(ctime(&result));
}
else {
    fprintf(stderr, "Invalid Format\n");
}

```