Add rtc.h header file

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3493 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2011-04-12 14:14:47 +00:00
parent 75661bee13
commit f96fb2fa03
7 changed files with 54 additions and 39 deletions
+2 -2
View File
@@ -85,9 +85,9 @@
*
****************************************************************************/
struct tm *gmtime(const time_t *clock)
struct tm *gmtime(const time_t *timer)
{
static struct tm tm;
return gmtime_r(clock, &tm);
return gmtime_r(timer, &tm);
}
+11 -11
View File
@@ -296,9 +296,9 @@ static void clock_utc2calendar(time_t days, int *year, int *month, int *day)
*
****************************************************************************/
struct tm *gmtime_r(const time_t *clock, struct tm *result)
struct tm *gmtime_r(const time_t *timer, struct tm *result)
{
time_t time;
time_t epoch;
time_t jdn;
int year;
int month;
@@ -309,21 +309,21 @@ struct tm *gmtime_r(const time_t *clock, struct tm *result)
/* Get the seconds since the EPOCH */
time = *clock;
sdbg("clock=%d\n", (int)time);
epoch = *timer;
sdbg("timer=%d\n", (int)epoch);
/* Convert to days, hours, minutes, and seconds since the EPOCH */
jdn = time / SEC_PER_DAY;
time -= SEC_PER_DAY * jdn;
jdn = epoch / SEC_PER_DAY;
epoch -= SEC_PER_DAY * jdn;
hour = time / SEC_PER_HOUR;
time -= SEC_PER_HOUR * hour;
hour = epoch / SEC_PER_HOUR;
epoch -= SEC_PER_HOUR * hour;
min = time / SEC_PER_MIN;
time -= SEC_PER_MIN * min;
min = epoch / SEC_PER_MIN;
epoch -= SEC_PER_MIN * min;
sec = time;
sec = epoch;
sdbg("hour=%d min=%d sec=%d\n",
(int)hour, (int)min, (int)sec);