时间管理

函数

void aos_calendar_time_set (uint64_t now_ms)
 
uint64_t aos_calendar_time_get (void)
 
uint64_t aos_calendar_localtime_get (void)
 
uint64_t aos_now (void)
 
uint64_t aos_now_ms (void)
 
aos_status_t aos_now_time_str (char *buffer, size_t len)
 Retrieves the timer string. Under RTOS w/o RTC, this fucntion will return the UTC time string that consider boot-up as 01-01 00:00:00.000. Under Linuxhost and compile option "vall=posix", this function will get the local time which considering time zone. 更多...
 
void aos_msleep (uint32_t ms)
 

详细描述

提供AliOS Things系统内核时间管理功能的基础API.

函数说明

◆ aos_calendar_localtime_get()

uint64_t aos_calendar_localtime_get ( void  )

Get calendar time with utc offset.

返回
current calendar time with utc offset (unit:ms).

◆ aos_calendar_time_get()

uint64_t aos_calendar_time_get ( void  )

Get calendar time.

返回
current calendar time (unit:ms), for example, the number of milliseconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).

◆ aos_calendar_time_set()

void aos_calendar_time_set ( uint64_t  now_ms)

Set calendar time.

参数
[in]now_msthe calender time (unit:ms) to set, for example, the number of milliseconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).

◆ aos_msleep()

void aos_msleep ( uint32_t  ms)

Msleep.

参数
[in]mssleep time in milliseconds.

◆ aos_now()

uint64_t aos_now ( void  )

Get current time in nanoseconds.

返回
elapsed time in nanoseconds from system starting.

◆ aos_now_ms()

uint64_t aos_now_ms ( void  )

Get current time in milliseconds.

返回
elapsed time in milliseconds from system starting.

◆ aos_now_time_str()

aos_status_t aos_now_time_str ( char *  buffer,
size_t  len 
)

Retrieves the timer string. Under RTOS w/o RTC, this fucntion will return the UTC time string that consider boot-up as 01-01 00:00:00.000. Under Linuxhost and compile option "vall=posix", this function will get the local time which considering time zone.

参数
[out]bufgive buffer to save timer string
[in]lenthe length of buffer, recommand 19, right a terminating null-character is appended in last.
返回
0: success.