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.

How to get absolute time in Cortex-M3?

I used the F28M35H52C1 in my system.

Now I have to connect to a module which needs the absolute time from my system. The absolute time is the seconds since the epoc, 1970-01-01 00:00:00 UTC. I havn't found any APIs using for this purpose.

How to get the absolute time? Thank you.

  • Hi,

    All you have to do is to include <time.h> in your file and use the provided functions - if you do not find them then can be easily downloaded from internet.

    Petrei

  • Petrei,

    Thank you. Merry Chirstmas!

    I have gotten the exact time. However, I suppose that the calendar time is seconds since 1900 1-1 00:00 according the value.

    The HTML documents writes:

    time_t time(time_t *tod);

    If tod is not a null pointer, the function stores the current calendar time in *tod. The function returns the current calendar time, if the target environment can determine it; otherwise, it returns -1.

    Is there some detailed manuals about the time and how the M3 restains it after power off?

  • Hi,

    Merry Christmas to you too!

    About detailed manual for time: I use the GCC library manual, but there is not too much information. Also use to read/understand the code for such routines if I can found them. CCS provides such code also.

    About how M3 behaves after power off: you should provide clock, battery and configuration for deep sleep of the peripheral in order to have the timer permanently working.

    Petrei

  • Petrei said:
    how M3 behaves after power off: you should provide clock, battery and configuration for deep sleep

    You may want to consider a rather, "large battery" - M3's here are (somewhat) famed for not being, "world beaters" when "hibernating" - or using other methods to reduce current draw.  As some report - "devil in the details" & a good read of the MCU manual seems indicated...