4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-01-30 15:50:28 +08:00

reformat the coding style

using -RT_ERROR instead of RT_ERROR for the return value


git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2311 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
dzzxzz@gmail.com 2012-09-29 00:14:29 +00:00
parent 2aab960999
commit ec1f35670d

View File

@ -29,7 +29,7 @@
#pragma module_name = "?time"
time_t (__time32)(time_t *t) /* Only supports 32-bit timestamp */
#else
time_t time(time_t* t)
time_t time(time_t *t)
#endif
{
static rt_device_t device = RT_NULL;
@ -71,10 +71,10 @@ time_t time(time_t* t)
rt_err_t set_date(rt_uint32_t year, rt_uint32_t month, rt_uint32_t day)
{
time_t now;
struct tm * p_tm;
struct tm *p_tm;
struct tm tm_new;
rt_device_t device;
rt_err_t ret = RT_ERROR;
rt_err_t ret = -RT_ERROR;
/* get current time */
now = time(RT_NULL);
@ -99,12 +99,12 @@ rt_err_t set_date(rt_uint32_t year, rt_uint32_t month, rt_uint32_t day)
device = rt_device_find("rtc");
if (device == RT_NULL)
{
return RT_ERROR;
return -RT_ERROR;
}
/* update to RTC device. */
ret = rt_device_control(device, RT_DEVICE_CTRL_RTC_SET_TIME, &now);
/* update to RTC device. */
return ret;
}
@ -119,10 +119,10 @@ rt_err_t set_date(rt_uint32_t year, rt_uint32_t month, rt_uint32_t day)
rt_err_t set_time(rt_uint32_t hour, rt_uint32_t minute, rt_uint32_t second)
{
time_t now;
struct tm * p_tm;
struct tm *p_tm;
struct tm tm_new;
rt_device_t device;
rt_err_t ret = RT_ERROR;
rt_err_t ret = -RT_ERROR;
/* get current time */
now = time(RT_NULL);
@ -147,18 +147,19 @@ rt_err_t set_time(rt_uint32_t hour, rt_uint32_t minute, rt_uint32_t second)
device = rt_device_find("rtc");
if (device == RT_NULL)
{
return RT_ERROR;
return -RT_ERROR;
}
/* update to RTC device. */
ret = rt_device_control(device, RT_DEVICE_CTRL_RTC_SET_TIME, &now);
/* update to RTC device. */
return ret;
}
#ifdef RT_USING_FINSH
#include <finsh.h>
#include <rtdevice.h>
void list_date(void)
{
time_t now;