Merge branch 'timekeeping' of bitbucket.org:nuttx/nuttx

This commit is contained in:
Gregory Nutt
2016-07-28 09:34:00 -06:00
21 changed files with 604 additions and 13 deletions
+6 -1
View File
@@ -1496,10 +1496,15 @@ void up_timer_initialize(void);
*
****************************************************************************/
#ifdef CONFIG_SCHED_TICKLESS
#if defined(CONFIG_SCHED_TICKLESS) && !defined(CONFIG_CLOCK_TIMEKEEPING)
int up_timer_gettime(FAR struct timespec *ts);
#endif
#ifdef CONFIG_CLOCK_TIMEKEEPING
int up_timer_getcounter(FAR uint64_t *cycles);
void up_timer_getmask(FAR uint64_t *mask);
#endif
/****************************************************************************
* Name: up_alarm_cancel
*
+6 -1
View File
@@ -215,7 +215,12 @@
#define SYS_clock_getres (__SYS_clock+1)
#define SYS_clock_gettime (__SYS_clock+2)
#define SYS_clock_settime (__SYS_clock+3)
#define __SYS_timers (__SYS_clock+4)
#ifdef CONFIG_CLOCK_TIMEKEEPING
# define SYS_adjtime (__SYS_clock+4)
# define __SYS_timers (__SYS_clock+5)
#else
# define __SYS_timers (__SYS_clock+4)
#endif
/* The following are defined only if POSIX timers are supported */
+42 -1
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* include/sys/time.h
*
* Copyright (C) 2009, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2009, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -112,6 +112,7 @@
/****************************************************************************
* Public Type Definitions
****************************************************************************/
/* struct timeval represents time as seconds plus microseconds */
struct timeval
@@ -190,6 +191,46 @@ int gettimeofday(FAR struct timeval *tv, FAR struct timezone *tz);
int settimeofday(FAR const struct timeval *tv, FAR struct timezone *tz);
/****************************************************************************
* Name: adjtime
*
* Description:
* The adjtime() function gradually adjusts the system clock (as returned
* by gettimeofday(2)). The amount of time by which the clock is to be
* adjusted is specified in the structure pointed to by delta.
*
* This structure has the following form:
*
* struct timeval
* {
* time_t tv_sec; (seconds)
* suseconds_t tv_usec; (microseconds)
* };
*
* If the adjustment in delta is positive, then the system clock is
* speeded up by some small percentage (i.e., by adding a small amount of
* time to the clock value in each second) until the adjustment has been
* completed. If the adjustment in delta is negative, then the clock is
* slowed down in a similar fashion.
*
* If a clock adjustment from an earlier adjtime() call is already in
* progress at the time of a later adjtime() call, and delta is not NULL
* for the later call, then the earlier adjustment is stopped, but any
* already completed part of that adjustment is not undone.
*
* If olddelta is not NULL, then the buffer that it points to is used to
* return the amount of time remaining from any previous adjustment that
* has not yet been completed.
*
* NOTE: This is not a POSIX interface but derives from 4.3BSD, System V.
* It is also supported for Linux compatibility.
*
****************************************************************************/
#ifdef CONFIG_CLOCK_TIMEKEEPING
int adjtime(FAR const struct timeval *delta, FAR struct timeval *olddelta);
#endif
#undef EXTERN
#if defined(__cplusplus)
}