Skip to main content
jg_spitfire
Senior
May 16, 2019
Question

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

  • May 16, 2019
  • 0 replies
  • 810 views

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

This topic has been closed for replies.