Get current system time

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
Pask
Posts: 47
Joined: Thu Jun 19, 2014 3:51 pm

Get current system time

Post by Pask »

I need to get current system time. Is there some function that can help me? i have read about chTimeNow() but it restart from zero. Someone can give me a solution. pls
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Get current system time

Post by Giovanni »

Hi,

The RTC driver, see examples.

Giovanni
Pask
Posts: 47
Joined: Thu Jun 19, 2014 3:51 pm

Re: Get current system time

Post by Pask »

i found this example code

Code: Select all

rtcGetTimeTm(&RTCD1, &timp);
chprintf(chp, "%s%s",asctime(&timp)," - formatted time string\r\n");


asctime what is? i don't find information
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Get current system time

Post by Giovanni »

Pask
Posts: 47
Joined: Thu Jun 19, 2014 3:51 pm

Re: Get current system time

Post by Pask »

ah ok ;-)
i need to get system time in system tick and convert it to us or ms.
Post Reply