+ 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);
+ }
+}
+
+
+/* Obtain the range of the trace (i.e. "start time" and "end time") */
+/* Note : This function, unlike ltt_trace_time_span_get, is assured to return all tracefiles to their correct position after operation */
+/* NOTE : this method is quite heavy to use!!! */
+JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedTracefileTimeRange(JNIEnv *env, jobject jobj, jlong trace_ptr, jobject jstart_time, jobject jend_time) {
+ LttTrace *newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr);
+
+ /* Allocate ourself a new array to save the data in */
+ GArray *savedDataArray = g_array_new(FALSE, FALSE, sizeof(struct saveTimeAndTracefile*) );
+ struct saveTimeArgs args = { savedDataArray };
+ /* Call g_datalist_foreach_saveTracefilesTime for each element in the GData to save the time */
+ g_datalist_foreach(&newPtr->tracefiles, &g_datalist_foreach_saveTracefilesTime, &args);
+
+ /* Call to ltt_trace_time_span_get to find the current start and end time */
+ /* NOTE : This WILL change the current block of the tracefile (i.e. its timestamp) */