cancel
Showing results for 
Search instead for 
Did you mean: 

How to get system time using uint32_t SysTime2Ms( SysTime_t sysTime ) function in BL072Z LoRa

jg_spitfire
Senior

Hi, i am trying to use this function but always return me 0

uint32_t SysTime2Ms( SysTime_t sysTime )
{
    SysTime_t DeltaTime;
    HW_RTC_BKUPRead( &DeltaTime.Seconds, ( uint32_t* )&DeltaTime.SubSeconds );
    SysTime_t calendarTime = SysTimeSub( sysTime, DeltaTime );
    return calendarTime.Seconds * 1000 + calendarTime.SubSeconds;
}

this is the argument that the function needs, i dont know if i am making something wrong (probably yes)

/*!
 * \brief Structure holding the system time in seconds and milliseconds.
 */
typedef struct SysTime_s
{
    uint32_t Seconds;
    int16_t  SubSeconds;
}SysTime_t;

my code:

SysTime_t time_argument[2];
 
uint32_t time;
 
int main( void )
{
time = SysTime2Ms(time_argument[1]);
while( 1 )
{
 PRINTF("system time: %d\n\r", time);
}
}

I am trying to get the system time in the BL072Z end_node example, i always have used Hal_GetTick(); but also returns 0.

thanks

0 REPLIES 0