/*
 * tesst.cpp
 *
 *  Created on: 02.01.2011
 *      Author: uwe
 */

#include "tesst.h"
#include <sys/time.h>
#include <unistd.h>

tesst::tesst(char *file, int num_threads) {
	this->t = 4;
	//this->file  = "/home/ubuntu/Pictures/103_0409/IMGP2040.DNG";
	this->file = file;
	if(num_threads > 0){
		this->num_threads = num_threads;
	}else{
		this->num_threads = 4;
	}

}

tesst::~tesst() {
	// TODO Auto-generated destructor stub
}

long long tesst::test()
{

	struct timeval tv1, tv2;
	//struct timezone tz;
	long long ti1, ti2;
	int size[2];
	//char *exif_info = NULL;
	char time[20];
	//unsigned int exif_info_size = 0;
	unsigned int exif_exposuretime[2];

	timerclear(&tv1);
	timerclear(&tv2);

	gettimeofday(&tv1, NULL);

	reader = create_Reader_02(this->file, num_threads);
	get_Exif_ExposureTime(reader,exif_exposuretime);
	get_Exif_DateTimeOriginal(reader, time);

	if(reader != NULL){
		set_Zoom(reader, 1.f, size);
		delete_Reader(reader);
	}

	gettimeofday(&tv2, NULL);
	
	ti1 = (long long)tv1.tv_sec * 1000000 + (long long)tv1.tv_usec;
	ti2 = (long long)tv2.tv_sec * 1000000 + (long long)tv2.tv_usec;
	return ti2 - ti1;
}
