+
+// g_list_data function for the "for_each" call in Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedTracefileTimeRange
+// used to save the current timestamp for each tracefile
+void g_datalist_foreach_saveTracefilesTime(GQuark name, gpointer data, gpointer user_data) {
+ struct saveTimeArgs* args = (struct saveTimeArgs*)user_data;
+
+ GArray* tracefile_array = (GArray*)data;
+ GArray* save_array = args->saveTimeArray;
+
+ LttTracefile* tracefile;
+ struct saveTimeAndTracefile* savedData;
+
+ unsigned int i;
+ for (i=0; i<tracefile_array->len; i++) {
+ tracefile = &g_array_index(tracefile_array, LttTracefile, i);
+
+ // Allocate a new LttTime for each tracefile (so it won't change if the tracefile seek somewhere else)
+ savedData = (struct saveTimeAndTracefile*)malloc( sizeof(struct saveTimeAndTracefile) );
+ savedData->time.tv_sec = tracefile->event.event_time.tv_sec;
+ savedData->time.tv_nsec = tracefile->event.event_time.tv_nsec;
+ savedData->tracefile = tracefile;
+ // Append the saved data to the array
+ g_array_append_val(save_array, savedData);
+ }
+}
+
+