time

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

time

1,729 Views
vladstoica
Contributor III


Hello,

 

How can I use time.h functions in S32 design studio? I tried clock() and also time() functions, but none of them works.

 

Thanks,

 

Vlad

Labels (1)
0 Kudos
4 Replies

1,586 Views
martin_kovar
NXP Employee
NXP Employee

Hi Vlad,

please look at the following thread. We have already solve this problem, so I hope it will help you. If not, please write me back.

https://community.nxp.com/message/640746#comment-640746

Regards,

Martin

0 Kudos

1,586 Views
vladstoica
Contributor III

Hello,

It doesn't work. I am using also newlib, but with or without the two ewl libraries, time() function always returns -1 (error code).

Vlad

0 Kudos

1,586 Views
vladstoica
Contributor III

Hello,

Can you send me a configured project that contains time() or clock() function? I looket at that thread,but it didn't work.

Thanks,

Vlad

0 Kudos

1,586 Views
martin_kovar
NXP Employee
NXP Employee

Hi Vlad,

sorry for my previous post. Return code -1 is correct, because the micro does not have any resources, how to return you correct time.

This is the clock function description:

This function returns the calling process' current CPU time. If the CPU time is not available or cannot be represented, clock returns the value (clock_t)(-1).

and this is the time function description:

The time function returns the current calendar time as a value of type time_t. If the argument result is not a null pointer, the calendar time value is also stored in *result. If the current calendar time is not available, the value (time_t)(-1) is returned.

So you cannot simply use these functions. The way, how to use these functions exists, but it will be pretty difficult and I do not have any experience with it. Please look at the follow  URL:

http://stackoverflow.com/questions/15030123/how-does-the-clock-function-in-ctime-access-the-system-c...

Regards,

Martin

0 Kudos