Commit 229c2652 authored by Yann Garcia's avatar Yann Garcia
Browse files

Review date/time

parent 717f6fa7
Loading
Loading
Loading
Loading
+9 −14
Original line number Diff line number Diff line
#include "LibItsGeoNetworking_Functions.hh"
#include <time.h>
#include <math.h>

#include "base_time.hh"
#include "loggers.hh"

namespace LibItsGeoNetworking__Functions
{
@@ -8,16 +9,10 @@ namespace LibItsGeoNetworking__Functions
         * @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);
INTEGER fx__computeGnTimestamp() {
  INTEGER i;
  i.set_long_long_val(base_time::get_instance().get_its_current_time_ms() % 4294967296); // Expresses the time in milliseconds at which the latitude and longitude of the ITS-S were acquired by the GeoAdhoc router. The time is encoded as: TST =TST(TAI)mod232 where TST(TAI) is the number of elapsed TAI milliseconds since 2004-01-01 00:00:00.000 UTC
  loggers::get_instance().log_msg("<<< fx__computeGnTimestamp: ", i);
  return i;
}