#include "LibItsGeoNetworking_Functions.hh"
#include <time.h>
#include <math.h>

namespace LibItsGeoNetworking__Functions
{
/*       * @desc    External function to compute timestamp based on current time
         * @return  Unix-Epoch-Time mod 2^32
        fx_computeGnTimestamp() return UInt32;
*/
INTEGER fx__computeGnTimestamp(
) {
			struct timeval tv;
			gettimeofday(&tv, NULL);

//			unsigned long long timestampNow = tv.tv_sec*1000 + tv.tv_usec/1000;
    long long timestampNow = tv.tv_sec*1000 + tv.tv_usec/1000;
    INTEGER i = INTEGER();
    i.set_long_long_val(timestampNow % 4294967296);
//			return INTEGER(timestampNow % 4294967296);
    return i;
}

} //end namespace
