view TaskManager/Fifo/gettime.h @ 1603:44ff9443cc1c draft

Display match lines.
author Masa <e085726@ie.u-ryukyu.ac.jp>
date Tue, 09 Apr 2013 17:17:57 +0900
parents 411401d1cb71
children 7673e2ad2623
line wrap: on
line source

#ifndef GETTIME_H_
#define GETTIME_H_

#include <time.h>
#ifdef __APPLE__
#include <sys/time.h>
#endif
/**
 *  Mac OS X側には、clock_gettimeがないので、gettimeofdayを使う
 */
inline unsigned long long gettime() {

	unsigned long long time = 0;
#ifdef __CERIUM_FIFO__  // ??
	struct timespec ts;

#ifndef __APPLE__
	clock_gettime(CLOCK_REALTIME, &ts);
#else
	struct timeval tv;
	gettimeofday(&tv, NULL);
	ts.tv_sec = tv.tv_sec;
	ts.tv_nsec = tv.tv_usec * 1000;
#endif

	time = ((ts.tv_sec << 32) | ts.tv_nsec );
#endif // __CERIUM_FIFO__
	return time;

}

#endif