Legato startup date change?

Hello,

When legato system starts default date is Jan 1. 1970. and I would like the date to be set to some other before my application starts.
I know I can set time trough my application by using “le_rtc_interface.h” API, but because I’m running my app in couple of processes I’d like the time to be already set inbefore they are started.

How can this be achieved?

You can set the apps to be started manually and write a script to start the apps according to your preference.

If I understood correctly, you are suggesting to make an app which will set the date/time as I wish and then start my app afterwards. That can work, only downside is having 2 apps instead of 1, is there any other way?
I was looking in a way of AT commands but couldn’t find any or maybe editing some files in SierraWireless system?

Then this might guarantee the time to be already set in before they are started.

This application has to be unsandboxed in order to be able to change the time of the system, am I correct? There is no way of changing the time from a sandboxed application?

can you post your application here?

#include “legato.h”
#include “interfaces.h”

// NEW_EPOCH_TIME_IN_MS is 2019. 1. 1. 00:00:00:000
#define NEW_EPOCH_TIME_IN_MS 1546300800000

COMPONENT_INIT
{
	const uint64_t newTime = 1546300800000;
    uint64_t msPastEpochPtr = 0;
    LE_INFO("Getting absolute time");
    le_clk_Time_t timeNow = le_clk_GetAbsoluteTime();
    LE_INFO("The time obtained is: %ld", timeNow.usec);
	le_clk_Time_t newTm;

    if((uint64_t)(timeNow.usec) < (newTime)){
    	LE_INFO("Date is sooner than 2019. 1. 1. it is going to be updated!");
    	newTm.usec = newTime;
    	le_clk_SetAbsoluteTime(newTm);
    }else LE_INFO("Readtime: %lld isn't less than %ld", msPastEpochPtr, newTm.usec);

    timeNow = le_clk_GetAbsoluteTime();
    LE_INFO("The time obtained is: %lld", (uint64_t)timeNow.usec);
}

From the log (I shortened it a bit to be easier to see):

Jan  1 00:31:16 swi-mdm9x28-wp user.info Legato:  Getting absolute time
Jan  1 00:31:16 swi-mdm9x28-wp user.info Legato:  The time obtained is: 326873
Jan  1 00:31:16 swi-mdm9x28-wp user.info Legato:  Time is less than the 2019. 1. 1. it is going to be updated.
Jan  1 00:31:16 swi-mdm9x28-wp user.err Legato: =ERR= | timetestapp[8169]/framework T=main | LE_FILENAME le_clk_SetAbsoluteTime() 597 | Setting CLOCK_REALTIME for Absolute time is not permitted
Jan  1 00:31:16 swi-mdm9x28-wp user.info Legato:  The time obtained is: 327150

Question was:

application has to be unsandboxed in order to be able to change the time of the system, am I correct?

Seems the legato documemt already says :

Absolute time can be set by unsandboxed applications using le_clk_SetAbsoluteTime().