Timer

image-20220419112531014
  1. Just turn on the timer in menuconfig

  2. In user code, you can use <sys/time.h> the header files provided by these timers to program

#include <sys/time.h>
#include <stdio.h>

int main(void)
{
    time_t sec;
    time_t ret;
    time_t timestamp = 1609459200;
    ret = time(&sec);

    if(ret != sec)
    {
        return -1;
    }
    if(ret != timestamp)
    {
        return -1;
    }
    return 0;
}copymistakeCopy Success

Last updated

Was this helpful?