mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:22:18 +08:00
sched/: Review and correct some stylistic inconsistencies
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* sched/clock/clock_abstime2ticks.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2013-2014, 2016 Gregory Nutt. All rights reserved.
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
@@ -44,11 +44,11 @@
|
||||
#include <debug.h>
|
||||
#include "clock/clock.h"
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: compare_timespec
|
||||
*
|
||||
* Description:
|
||||
@@ -56,7 +56,7 @@
|
||||
* Return > 0 if time b is before time a
|
||||
* Return 0 if time a is the same as time b
|
||||
*
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static long compare_timespec(FAR const struct timespec *a,
|
||||
FAR const struct timespec *b)
|
||||
@@ -74,11 +74,11 @@ static long compare_timespec(FAR const struct timespec *a,
|
||||
return (long)a->tv_nsec -(long)b->tv_nsec;
|
||||
}
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: clock_abstime2ticks
|
||||
*
|
||||
* Description:
|
||||
@@ -93,10 +93,10 @@ static long compare_timespec(FAR const struct timespec *a,
|
||||
* OK on success; A non-zero error number on failure;
|
||||
*
|
||||
* Assumptions:
|
||||
* Interrupts should be disabled so that the time is not changing during the
|
||||
* calculation
|
||||
* Interrupts should be disabled so that the time is not changing during
|
||||
* the calculation
|
||||
*
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
int clock_abstime2ticks(clockid_t clockid, FAR const struct timespec *abstime,
|
||||
FAR int *ticks)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* sched/clock/clock_ticks2time.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
@@ -31,22 +31,22 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <time.h>
|
||||
#include "clock/clock.h"
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: clock_ticks2time
|
||||
*
|
||||
* Description:
|
||||
@@ -61,7 +61,7 @@
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
int clock_ticks2time(int ticks, FAR struct timespec *reltime)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* sched/clock/clock_time2ticks.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
@@ -44,17 +44,17 @@
|
||||
|
||||
#include "clock/clock.h"
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: clock_time2ticks
|
||||
*
|
||||
* Description:
|
||||
* Convert a timespec delay to system timer ticks. This function is suitable
|
||||
* for calculating relative time delays and does not depend on the other
|
||||
* clock_* logic.
|
||||
* Convert a timespec delay to system timer ticks. This function is
|
||||
* suitable for calculating relative time delays and does not depend on
|
||||
* the other clock_* logic.
|
||||
*
|
||||
* Parameters:
|
||||
* reltime - Convert this relative time to system clock ticks.
|
||||
@@ -65,15 +65,15 @@
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
int clock_time2ticks(FAR const struct timespec *reltime, FAR int *ticks)
|
||||
{
|
||||
#ifdef CONFIG_HAVE_LONG_LONG
|
||||
int64_t relnsec;
|
||||
|
||||
/* Convert the relative time into nanoseconds. The range of the int64_t is
|
||||
* sufficiently large that there is no real need for range checking.
|
||||
/* Convert the relative time into nanoseconds. The range of the int64_t
|
||||
* is sufficiently large that there is no real need for range checking.
|
||||
*/
|
||||
|
||||
relnsec = (int64_t)reltime->tv_sec * NSEC_PER_SEC +
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/************************************************************************
|
||||
/****************************************************************************
|
||||
* sched/clock/clock_timekeeping.c
|
||||
*
|
||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
@@ -52,9 +52,9 @@
|
||||
|
||||
#include "clock/clock.h"
|
||||
|
||||
/************************************************************************
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#define NTP_MAX_ADJUST 500
|
||||
|
||||
@@ -68,13 +68,13 @@ static uint64_t g_clock_last_counter;
|
||||
static uint64_t g_clock_mask;
|
||||
static long g_clock_adjust;
|
||||
|
||||
/************************************************************************
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: clock_get_current_time
|
||||
************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static int clock_get_current_time(FAR struct timespec *ts,
|
||||
FAR struct timespec *base)
|
||||
@@ -114,31 +114,31 @@ errout_in_critical_section:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: clock_timekeeping_get_monotonic_time
|
||||
************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
int clock_timekeeping_get_monotonic_time(FAR struct timespec *ts)
|
||||
{
|
||||
return clock_get_current_time(ts, &g_clock_monotonic_time);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: clock_timekeeping_get_wall_time
|
||||
************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
int clock_timekeeping_get_wall_time(FAR struct timespec *ts)
|
||||
{
|
||||
return clock_get_current_time(ts, &g_clock_wall_time);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: clock_timekeeping_set_wall_time
|
||||
************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
int clock_timekeeping_set_wall_time(FAR struct timespec *ts)
|
||||
{
|
||||
@@ -163,7 +163,7 @@ errout_in_critical_section:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
/********************************************************************************
|
||||
* Name: adjtime
|
||||
*
|
||||
* Description:
|
||||
@@ -226,9 +226,9 @@ int adjtime(FAR const struct timeval *delta, FAR struct timeval *olddelta)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: clock_update_wall_time
|
||||
************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
void clock_update_wall_time(void)
|
||||
{
|
||||
@@ -304,9 +304,9 @@ errout_in_critical_section:
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: clock_inittimekeeping
|
||||
************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
void clock_inittimekeeping(void)
|
||||
{
|
||||
@@ -318,7 +318,9 @@ void clock_inittimekeeping(void)
|
||||
|
||||
(void)up_rtc_getdatetime(&rtctime);
|
||||
|
||||
/* And use the broken-errout_in_critical_section time to initialize the system time */
|
||||
/* And use the broken-errout_in_critical_section time to initialize the
|
||||
* system time.
|
||||
*/
|
||||
|
||||
g_clock_wall_time.tv_sec = mktime(&rtctime);
|
||||
g_clock_wall_time.tv_nsec = 0;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* sched/clock/clock_timespec_add.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
@@ -44,9 +44,9 @@
|
||||
|
||||
#include "clock/clock.h"
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: clock_timespec_add
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* sched/clock/clock_timespec_subtract.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
@@ -44,9 +44,9 @@
|
||||
|
||||
#include "clock/clock.h"
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: clock_timespec_subtract
|
||||
|
||||
Reference in New Issue
Block a user