#ifndef __JSYSTEM__JTIME__ #define __JSYSTEM__JTIME__ #include #include /** * \file * System time information. * \author mdejong */ namespace JSYSTEM {} namespace JPP { using namespace JSYSTEM; } namespace JSYSTEM { /** * Type definition of local time. */ typedef long long int localtime_t; /** * Auxililary class to local get time in micro seconds. */ struct JLocalTime { /** * Default constructor. */ JLocalTime() {} /** * Get local time in micro seconds. * * \return time [us] */ localtime_t operator()() const { gettimeofday(&t, &tz); usec = t.tv_sec; usec *= 1000000ULL; usec += t.tv_usec; return usec; } private: mutable localtime_t usec; mutable struct timeval t; mutable struct timezone tz; }; /** * Function object to get local time in micro seconds. */ static const JLocalTime getLocalTime; } #endif