diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-12-14 18:39:29 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-12-14 18:39:29 +0000 |
commit | 59f367c060c408a9c9f2ee6db3a4fd498c4a2724 (patch) | |
tree | 80d034ca2b741e6d5b074758c5285f804f772c66 /nuttx/sched/clock_gettime.c | |
parent | 24bdea23f746984480bd59dd13dd4d631a210320 (diff) | |
download | px4-nuttx-59f367c060c408a9c9f2ee6db3a4fd498c4a2724.tar.gz px4-nuttx-59f367c060c408a9c9f2ee6db3a4fd498c4a2724.tar.bz2 px4-nuttx-59f367c060c408a9c9f2ee6db3a4fd498c4a2724.zip |
Switching to C99 stdint.h types
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2336 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/clock_gettime.c')
-rw-r--r-- | nuttx/sched/clock_gettime.c | 67 |
1 files changed, 35 insertions, 32 deletions
diff --git a/nuttx/sched/clock_gettime.c b/nuttx/sched/clock_gettime.c index 68c8b6492..6b8ac8c79 100644 --- a/nuttx/sched/clock_gettime.c +++ b/nuttx/sched/clock_gettime.c @@ -1,7 +1,7 @@ -/************************************************************ - * clock_gettime.c +/************************************************************************ + * sched/clock_gettime.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,63 +31,66 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ************************************************************************/ -/************************************************************ +/************************************************************************ * Included Files - ************************************************************/ + ************************************************************************/ -#include <sys/types.h> +#include <nuttx/config.h> + +#include <stdint.h> #include <time.h> #include <errno.h> #include <debug.h> + #include "clock_internal.h" -/************************************************************ +/************************************************************************ * Definitions - ************************************************************/ + ************************************************************************/ -/************************************************************ +/************************************************************************ * Private Type Declarations - ************************************************************/ + ************************************************************************/ -/************************************************************ +/************************************************************************ * Private Function Prototypes - ************************************************************/ + ************************************************************************/ -/********************************************************** +/********************************************************************** * Public Constant Data - **********************************************************/ + **********************************************************************/ -/************************************************************ +/************************************************************************ * Public Variables - ************************************************************/ + ************************************************************************/ -/********************************************************** +/********************************************************************** * Private Variables - **********************************************************/ + **********************************************************************/ -/************************************************************ +/************************************************************************ * Private Functions - ************************************************************/ + ************************************************************************/ -/************************************************************ +/************************************************************************ * Public Functions - ************************************************************/ + ************************************************************************/ -/************************************************************ +/************************************************************************ * Function: clock_gettime * * Description: * Clock Functions based on POSIX APIs * - ************************************************************/ + ************************************************************************/ int clock_gettime(clockid_t clock_id, struct timespec *tp) { - uint32 msecs; - uint32 secs; - uint32 nsecs; + uint32_t msecs; + uint32_t secs; + uint32_t nsecs; int ret = OK; sdbg("clock_id=%d\n", clock_id); @@ -123,14 +126,14 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp) /* Add the base time to this. */ - secs += (uint32)g_basetime.tv_sec; - nsecs += (uint32)g_basetime.tv_nsec; + secs += (uint32_t)g_basetime.tv_sec; + nsecs += (uint32_t)g_basetime.tv_nsec; /* Handle carry to seconds. */ if (nsecs > NSEC_PER_SEC) { - uint32 dwCarrySecs = nsecs / NSEC_PER_SEC; + uint32_t dwCarrySecs = nsecs / NSEC_PER_SEC; secs += dwCarrySecs; nsecs -= (dwCarrySecs * NSEC_PER_SEC); } |