This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/EK-TM4C1294XL: time () with milliseconds

Part Number: EK-TM4C1294XL

Tool/software: TI-RTOS

Hello,
I have an EK-TM4C1294 development board and use TI-RTOS v2.16.1.14.
I get data through the UART interface and save the current time with the overridden time() function.

time_t t32 = time (NULL);
System_printf ("%s", ctime (&t32));

But I also need the time in milliseconds. How do I get the time in milliseconds?

  • Hi Mark,

     It seems to me that this question is more a C library function capability using time() and ctime() rather than TI-RTOS's System_printf. As I understand the ctime() and time() usage, you are limited to the seconds granularity, not milliseconds. 

  • OK,
    just how can I realize a time similar to the time () function in milliseconds?
  • Hi Mark,
    The TI-RTOS provides the Seconds module which offers a very similar capability as the C library time(). Please refer to section 5.4 in the SYS/BIOS user's guide. www.ti.com/.../spruex3u.pdf. However, it does not give you the milliseconds.

    Another thing for you to consider is using Timestamp module from the kernel. Calls to the Timestamp module function are forwarded to a platform-specific TimestampProvider implementation. In another word it will make use of the on-chip hardware timer module. See section 5.5 of the SYS/BIOS user's guide. Or you can go to chapter 7 of the TI-RTOS training slides for more about the Clock modules and Timestamp. training.ti.com/.../TI_RTOS_Kernel_Workshop_Student_Guide_rev4.00.pdf. However, this timestamp does not stamp the current real time clock (hh:mm:ss:ms) if this is what you are looking for.
  • Hi Mark,

    I have not heard back from you. I assume you understand the limitation in timing granularity of time() and ctime() from the stand C library as well from TI-RTOS. You might want to consider combining both the time() and the timestamp feature as described in the Clock module. I will close this thread for now. If you have new questions you can open a new thread or provide some comments to this thread. Again, I'm not aware of other ways to provide a wall clock down to milliseconds other the approaches provided above.