Commit d2bcd4af authored by garciay's avatar garciay
Browse files

Add external function f_getMinuteOfTheYear()

Editorial changes
parent 52c787f0
......@@ -29,7 +29,7 @@ public interface IItsExternalFunctionsProvider {
public IntegerValue fx_getCurrentTime();
/**
* This external function gets the current time
* This external function gets the tenths of a second in the current or next hour in units of 1/10th second from UTC time
* @return The current time in tenths of a second in the current or next hour in units of 1/10th second from UTC time
*
* TTCN-3 signature:
......@@ -37,6 +37,15 @@ public interface IItsExternalFunctionsProvider {
*/
public IntegerValue fx_getCurrentTimeMark();
/**
* This external function gets the minutes of current UTC year
* @return The minutes of current UTC year
*
* TTCN-3 signature:
* external function fx_getMinuteOfTheYear() return MinuteOfTheYear;
*/
public IntegerValue fx_getMinuteOfTheYear();
/**
* This external function gets the current time
* @param p_latitudeA Latitude of node A
......
......@@ -135,7 +135,7 @@ public class ItsExternalFunctionsProvider implements IItsExternalFunctionsProvid
}
return now;
} // End of method fx_getCurrentTime
@Override
public IntegerValue fx_getCurrentTimeMark() {
IntegerValue now = null;
......@@ -148,6 +148,18 @@ public class ItsExternalFunctionsProvider implements IItsExternalFunctionsProvid
return now;
}
@Override
public IntegerValue fx_getMinuteOfTheYear() {
IntegerValue now = null;
//_logger.entering("ItsExternalFunctionsProvider", "fx_getMinuteOfTheYear");
ZonedDateTime t = ZonedDateTime.now(ZoneOffset.UTC);
now = _tcicdWrapper.setInteger(new Integer((t.getDayOfYear() - 1) * 24 * 60 + t.getHour() * 60 + t.getMinute()));
//_logger.exiting("ItsExternalFunctionsProvider", "fx_getMinuteOfTheYear", String.format("%4d", _tcicdWrapper.getBigInteger(now)));
return now;
}
/**
* This external function gets the current time
*
......
......@@ -276,8 +276,11 @@ public class PluginAdapter implements TriCommunicationSA, TriCommunicationTE, xT
// Gets the current time
exec_getCurrentTime(returnValue);
} else if (functionId.getFunctionName().endsWith("fx_getCurrentTimeMark")) {
// Gets the current time
// Gets the tenths of a second in the current or next hour in units of 1/10th second from UTC time
exec_getCurrentTimeMark(returnValue);
} else if (functionId.getFunctionName().endsWith("fx_getMinuteOfTheYear")) {
// Gets the the minutes of current UTC year
exec_getMinuteOfTheYear(returnValue);
} else if (functionId.getFunctionName().endsWith("xf_parseIpv6Address")) {
exec_parseIpv6Address(parameterList, returnValue);
} else if (functionId.getFunctionName().endsWith("fx_hashWithSha256") && (parameterList.size() == 1)) {
......@@ -665,6 +668,23 @@ public class PluginAdapter implements TriCommunicationSA, TriCommunicationTE, xT
//_logger.exiting("PluginAdapter", "exec_getCurrentTimeMark: ", ByteHelper.byteArrayToString(returnValue.getEncodedParameter()));
} // End of method exec_getCurrentTimeMark
private void exec_getMinuteOfTheYear(TriParameter returnValue) {
//_logger.entering("PluginAdapter", "exec_getMinuteOfTheYear");
// Execute the function
IntegerValue time = _extfuncsImpl.fx_getMinuteOfTheYear();
//_logger.info(String.format("exec_getMinuteOfTheYear returns %d", ((IntegerValueEx)time).getInt64()));
returnValue.setParameterPassingMode(TriParameterPassingMode.TRI_OUT);
returnValue.setNumberOfBits(Long.SIZE);
returnValue.setEncodedParameter(
ByteHelper.longToByteArray(
((IntegerValueEx)time).getInt64(),
2/*Short.SIZE / Byte.SIZE*/ // Encoding on 16 bits
));
//_logger.exiting("PluginAdapter", "exec_getMinuteOfTheYear: ", ByteHelper.byteArrayToString(returnValue.getEncodedParameter()));
} // End of method exec_getMinuteOfTheYear
private void exec_generateKeyPair(TriParameterList parameterList, TriParameter returnValue) {
_logger.entering("PluginAdapter", "exec_generateKeyPair");
......
......@@ -126,6 +126,18 @@ public class ExternalFunctionsPluginProvider implements ExternalFunctionsProvide
return _externalFunctionsPluginProvider.fx_getCurrentTimeMark();
}
/**
* This external function gets the current time
* @return The current time in tenths of a second in the current or next hour in units of 1/10th second from UTC time
*
* TTCN-3 signature:
* external function fx_getMinuteOfTheYear() return MinuteOfTheYear;
*/
@Override
public IntegerValue fx_getMinuteOfTheYear() {
return _externalFunctionsPluginProvider.fx_getMinuteOfTheYear();
}
/**
* External function to compute timestamp based on current time
* @return Unix-Epoch-Time mod 2^32
......
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