Commit 2a7d2f7d authored by filatov's avatar filatov

remove constant recalculation in fx_GetCurrentTime

parent 1cada3ed
......@@ -10,9 +10,6 @@ import java.io.IOException;
import java.math.BigInteger;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.ArrayList;
......@@ -70,7 +67,7 @@ public class ItsExternalFunctionsProvider implements IItsExternalFunctionsProvid
private static final String GNSS_SCENARIO_SUPPORT = "GnssScenarioSupport";
private IGnssSupport GNSS;
private boolean gnssScenarioSupport;
/**
* Reference to the ePassport files manager
*/
......@@ -112,21 +109,14 @@ public class ItsExternalFunctionsProvider implements IItsExternalFunctionsProvid
now = _tcicdWrapper.setInteger(GNSS.getGpsTime());
}
else {
String datestr="01/01/2004 00:00:00 +0000";
DateFormat formatter = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss Z");
try {
// TERFactory.getInstance().logDebug("ItsExternalFunctionsProvider.fx_getCurrentTime: " + ((java.util.Date)formatter.parse(datestr)).getTime());
// TERFactory.getInstance().logDebug("ItsExternalFunctionsProvider.fx_getCurrentTime: " + ((java.util.Date)formatter.parse(datestr)).getTime());
now = _tcicdWrapper.setInteger(
new BigInteger(
1,
ByteHelper.longToByteArray(System.currentTimeMillis() - ((java.util.Date)formatter.parse(datestr)).getTime(), Long.SIZE / Byte.SIZE)
ByteHelper.longToByteArray(System.currentTimeMillis() - ITS_REF_TIME, Long.SIZE / Byte.SIZE)
)
);
} catch (ParseException e) {
now = _tcicdWrapper.setInteger(0);
}
//TERFactory.getInstance().logDebug("ItsExternalFunctionsProvider", "fx_getCurrentTime", String.format("%10d", _tcicdWrapper.getBigInteger(now)));
//TERFactory.getInstance().logDebug("ItsExternalFunctionsProvider", "fx_getCurrentTime", String.format("%10d", _tcicdWrapper.getBigInteger(now)));
}
return now;
} // End of method fx_getCurrentTime
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment