Skip to content
Snippets Groups Projects
Commit 83602d0d authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Improvement on f_getYear and f_getMonth functions

parent 267ceff9
No related branches found
1 merge request!55Improvement on f_getYear and f_getMonth functions
......@@ -3459,7 +3459,7 @@ module OneM2M_Functions {
* @param p_timestamp Given timestamp
* @return Year
*/
function f_getYear(charstring p_timestamp) runs on Tester return charstring {
function f_getYear(charstring p_timestamp) runs on Tester return integer {
var charstring v_year := "";
var integer i;
......@@ -3467,7 +3467,7 @@ module OneM2M_Functions {
for(i := 0; i <= 3; i := i+1){
v_year := v_year & p_timestamp[i];
}
return v_year;
return str2int(v_year);
} // end f_getYear
......@@ -3476,7 +3476,7 @@ module OneM2M_Functions {
* @param p_timestamp Given timestamp
* @return Year
*/
function f_getMonth(charstring p_timestamp) runs on Tester return charstring {
function f_getMonth(charstring p_timestamp) runs on Tester return integer {
var charstring v_month := "";
var integer i;
......@@ -3486,7 +3486,7 @@ module OneM2M_Functions {
v_month := v_month & p_timestamp[i];
}
}
return v_month;
return str2int(v_month);
} // end f_getYear
......
......@@ -5844,7 +5844,7 @@ module OneM2M_PermutationFunctions {
// Preamble
v_createRequest := f_getCreateRequestPrimitive(int1, m_createAcpBase, -1);
v_currentTime := fx_generateTimestamp();
v_accessControlRule.accessControlContexts_list := {{{"* * * * " & f_getMonth(v_currentTime) & " *"}, omit, omit}};
v_accessControlRule.accessControlContexts_list := {{{"* * * * " & int2str(f_getMonth(v_currentTime)) & " *"}, omit, omit}};
v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {v_accessControlRule};
vc_acpAuxIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
......@@ -5892,7 +5892,7 @@ module OneM2M_PermutationFunctions {
function f_CSE_SEC_ACP_006(template RequestPrimitive p_requestPrimitive, in ResponseStatusCode p_responseStatusCode) runs on AeSimu{
// Local variables
var MsgIn v_response;
var charstring v_month;
var integer v_month;
var charstring v_currentTime;
var integer v_aeIndex := -1;
var RequestPrimitive v_createRequest;
......@@ -5909,12 +5909,12 @@ module OneM2M_PermutationFunctions {
v_createRequest := f_getCreateRequestPrimitive(int1, m_createAcpBase, -1);
v_currentTime := fx_generateTimestamp();
v_month := f_getMonth(v_currentTime);
if(v_month =="12") {
v_month := "1";
if(v_month == 12) {
v_month := 1;
} else {
v_month := int2char(char2int(v_month) + 1);
v_month := v_month + 1;
}
v_accessControlRule.accessControlContexts_list := {{{"* * * * " & v_month & " *"}, omit, omit}};
v_accessControlRule.accessControlContexts_list := {{{"* * * * " & int2str(v_month) & " *"}, omit, omit}};
v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {v_accessControlRule};
vc_acpAuxIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment