summaryrefslogtreecommitdiff
path: root/nuttx/include
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-04-12 14:14:47 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-04-12 14:14:47 +0000
commitd5d9e262ee50ae2f423f0587090eb4573c98e6c3 (patch)
tree55e64594b3b8a3a2235ac3f37c736d44813e725f /nuttx/include
parent087feacd1d4ad183b8c9b81a1c664ebfea1278e1 (diff)
downloadpx4-nuttx-d5d9e262ee50ae2f423f0587090eb4573c98e6c3.tar.gz
px4-nuttx-d5d9e262ee50ae2f423f0587090eb4573c98e6c3.tar.bz2
px4-nuttx-d5d9e262ee50ae2f423f0587090eb4573c98e6c3.zip
Add rtc.h header file
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3493 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include')
-rw-r--r--nuttx/include/sys/time.h6
-rw-r--r--nuttx/include/sys/types.h4
-rw-r--r--nuttx/include/time.h25
3 files changed, 25 insertions, 10 deletions
diff --git a/nuttx/include/sys/time.h b/nuttx/include/sys/time.h
index d9493b386..2ac8ae004 100644
--- a/nuttx/include/sys/time.h
+++ b/nuttx/include/sys/time.h
@@ -33,8 +33,8 @@
*
****************************************************************************/
-#ifndef __SYS_MMAN_H
-#define __SYS_MMAN_H
+#ifndef __INCLUDE_SYS_TIME_H
+#define __INCLUDE_SYS_TIME_H
/****************************************************************************
* Included Files
@@ -71,4 +71,4 @@ EXTERN int gettimeofday(struct timeval *tp, FAR void *tzp);
}
#endif
-#endif /* __SYS_MMAN_H */
+#endif /* __INCLUDE_SYS_TIME_H */
diff --git a/nuttx/include/sys/types.h b/nuttx/include/sys/types.h
index 736d2fb75..43731f13c 100644
--- a/nuttx/include/sys/types.h
+++ b/nuttx/include/sys/types.h
@@ -179,6 +179,10 @@ typedef int16_t blksize_t;
typedef unsigned int socklen_t;
typedef uint16_t sa_family_t;
+/* Used for system times in clock ticks */
+
+typedef uint32_t clock_t;
+
/* The type useconds_t shall be an unsigned integer type capable of storing
* values at least in the range [0, 1000000]. The type suseconds_t shall be
* a signed integer type capable of storing values at least in the range
diff --git a/nuttx/include/time.h b/nuttx/include/time.h
index e3560b5c1..fab20e020 100644
--- a/nuttx/include/time.h
+++ b/nuttx/include/time.h
@@ -49,15 +49,22 @@
* Pre-processor Definitions
********************************************************************************/
-/* Clock tick of the system (frequency Hz). The default value is 100Hz, but this
- * default setting can be overridden by defining the clock interval in
- * milliseconds as CONFIG_MSEC_PER_TICK in the board configuration file.
+/* Clock tick of the system (frequency Hz).
+ *
+ * NOTE: This symbolic name CLK_TCK has been removed from the standard. It is
+ * replaced with CLOCKS_PER_SEC. Both are defined here.
+ *
+ * The default value is 100Hz, but this default setting can be overridden by
+ * defining the clock interval in milliseconds as CONFIG_MSEC_PER_TICK in the
+ * board configuration file.
*/
#ifdef CONFIG_MSEC_PER_TICK
-# define CLK_TCK (1000/CONFIG_MSEC_PER_TICK)
+# define CLK_TCK (1000/CONFIG_MSEC_PER_TICK)
+# define CLOCKS_PER_SEC (1000/CONFIG_MSEC_PER_TICK)
#else
-# define CLK_TCK (100)
+# define CLK_TCK (100)
+# define CLOCKS_PER_SEC (100)
#endif
/* This is the only clock_id supported by the "Clock and Timer
@@ -141,15 +148,19 @@ extern "C" {
#define EXTERN extern
#endif
+EXTERN clock_t clock(void);
+
EXTERN int clock_settime(clockid_t clockid, const struct timespec *tp);
EXTERN int clock_gettime(clockid_t clockid, struct timespec *tp);
EXTERN int clock_getres(clockid_t clockid, struct timespec *res);
EXTERN time_t mktime(const struct tm *tp);
-EXTERN struct tm *gmtime(const time_t *clock);
-EXTERN struct tm *gmtime_r(const time_t *clock, struct tm *result);
+EXTERN struct tm *gmtime(const time_t *timer);
+EXTERN struct tm *gmtime_r(const time_t *timer, struct tm *result);
EXTERN size_t strftime(char *s, size_t max, const char *format, const struct tm *tm);
+EXTERN time_t time(time_t *tloc);
+
EXTERN int timer_create(clockid_t clockid, FAR struct sigevent *evp, FAR timer_t *timerid);
EXTERN int timer_delete(timer_t timerid);
EXTERN int timer_settime(timer_t timerid, int flags, FAR const struct itimerspec *value,