Unable to use the strftime function defined in time file

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to use the strftime function defined in time file

634 Views
anoop_radhakris
Contributor II

Hi,

Iam working on s32k144 board using s32 design studio for ARM version 2018.R1. I was trying to use the function strftime defined in time.c file for getting the current time and date. But while using strftime in project, Iam getting an error message saying undefined reference to 'strftime'.When I checked the include path, Iam able to see the path for the file already included.I have attached the code which Iam trying.So kindly help me with this issue.

Regards,

Anoop

2 Replies

539 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hello anoop.radhskrishnan.nair.007@gmail.com‌,

I have tried this using the example lpuart_echo_s32k144 from the SDK (if you don't have the SDK please check the following link), adding the following code I didn't have problems with the route:

  time_t rawtime;
  struct tm *info;
  char buffer[80];

  time( &rawtime );

  info = localtime( &rawtime );

  strftime(buffer,80,"%x - %I:%M%p", info);

  LPUART_DRV_SendDataBlocking(INST_LPUART1, (uint8_t *)buffer, 80, TIMEOUT);

pastedImage_1.png

I think this could be related to the project settings. Be sure that you're enabling the libraries (newlib/redlib).

pastedImage_2.png

For reference, I'm using S32 Design Studio for ARM (Version: 2.2)

I hope this helps you.

Best Regards,

Alexis Andalon

539 Views
anoop_radhakris
Contributor II

Hi Alexis,

Thanks for your reply.I will try this and let you know.

Regards,

Anoop

0 Kudos