git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
reduce the size of ppage by 8 bytes using signly linked list
[lunaix-os.git]
/
lunaix-os
/
includes
/
lunaix
/
clock.h
diff --git
a/lunaix-os/includes/lunaix/clock.h
b/lunaix-os/includes/lunaix/clock.h
index 44dfa04b7da5c8e0bcdd3f5b844877d10ca0dfa3..3cb1e4e5f6838398c0d04419bf74106ab3869f7f 100644
(file)
--- a/
lunaix-os/includes/lunaix/clock.h
+++ b/
lunaix-os/includes/lunaix/clock.h
@@
-1,30
+1,17
@@
#ifndef __LUNAIX_CLOCK_H
#define __LUNAIX_CLOCK_H
#ifndef __LUNAIX_CLOCK_H
#define __LUNAIX_CLOCK_H
-#include <
stdint
.h>
+#include <
lunaix/time
.h>
-typedef uint32_t time_t;
+#include <hal/hwrtc.h>
+#include <hal/hwtimer.h>
-typedef struct
-{
- uint32_t year; // use int32 as we need to store the 4-digit year
- uint8_t month;
- uint8_t day;
- uint8_t weekday;
- uint8_t hour;
- uint8_t minute;
- uint8_t second;
-} datetime_t;
-
-void
-clock_init();
+extern const struct hwrtc_potens* sysrtc;
+extern const struct hwtimer_pot* systimer;
void
clock_walltime(datetime_t* datetime);
void
clock_walltime(datetime_t* datetime);
-int
-clock_datatime_eq(datetime_t* a, datetime_t* b);
-
/**
* @brief 返回当前系统时间,即自从开机到当前时刻的毫秒时。
*
/**
* @brief 返回当前系统时间,即自从开机到当前时刻的毫秒时。
*
@@
-36,12
+23,10
@@
clock_systime();
time_t
clock_unixtime();
time_t
clock_unixtime();
-static inline
time_t
-clock_
tounixtime(datetime_t* dt
)
+static inline
void
+clock_
init(
)
{
{
- return (dt->year - 1970) * 31556926u + (dt->month - 1) * 2629743u +
- (dt->day - 1) * 86400u + (dt->hour - 1) * 3600u +
- (dt->minute - 1) * 60u + dt->second;
+ hwrtc_init();
}
#endif /* __LUNAIX_CLOCK_H */
}
#endif /* __LUNAIX_CLOCK_H */