Move struct timveval from include/time.h to include/sys/time.h where it belongs.

This commit is contained in:
Gregory Nutt 2015-02-15 13:00:44 -06:00
parent caa94975a9
commit fd8d374bfe
6 changed files with 49 additions and 34 deletions

View File

@ -275,15 +275,17 @@
struct rtc_time
{
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday; /* unused */
int tm_yday; /* unused */
int tm_isdst; /* unused */
int tm_sec; /* Seconds (0-61, allows for leap seconds) */
int tm_min; /* Minutes (0-59) */
int tm_hour; /* Hours (0-23) */
int tm_mday; /* Day of the month (1-31) */
int tm_mon; /* Month (0-11) */
int tm_year; /* Years since 1900 */
#ifdef CONFIG_LIBC_LOCALTIME
int tm_wday; /* Day of the week (0-6) (unused) */
int tm_yday; /* Day of the year (0-365) (unused) */
int tm_isdst; /* Non-0 if daylight savings time is in effect (unused) */
#endif
};
#ifdef CONFIG_RTC_ALARM
@ -427,7 +429,7 @@ struct rtc_lowerhalf_s
FAR const struct rtc_ops_s *ops;
/* Data following this can vary from RTC driver to driver */
/* Data following this can vary from RTC driver-to-driver */
};
/****************************************************************************

View File

@ -74,7 +74,8 @@
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
extern "C"
{
#else
#define EXTERN extern
#endif
@ -87,7 +88,7 @@ extern "C" {
*
****************************************************************************/
EXTERN int clock_isleapyear(int year);
int clock_isleapyear(int year);
/****************************************************************************
* Function: clock_daysbeforemonth
@ -97,7 +98,7 @@ EXTERN int clock_isleapyear(int year);
*
****************************************************************************/
EXTERN int clock_daysbeforemonth(int month, bool leapyear);
int clock_daysbeforemonth(int month, bool leapyear);
/****************************************************************************
* Function: clock_calendar2utc
@ -110,7 +111,7 @@ EXTERN int clock_daysbeforemonth(int month, bool leapyear);
*
****************************************************************************/
EXTERN time_t clock_calendar2utc(int year, int month, int day);
time_t clock_calendar2utc(int year, int month, int day);
#undef EXTERN
#ifdef __cplusplus

View File

@ -51,7 +51,13 @@
/****************************************************************************
* Public Type Definitions
****************************************************************************/
/* struct timeval is defined in time.h */
/* struct timeval represents time as seconds plus microseconds */
struct timeval
{
time_t tv_sec; /* Seconds */
long tv_usec; /* Microseconds */
};
/* The use of the struct timezone is obsolete; the tz argument should
* normally be specified as NULL (and is ignored in any event).

View File

@ -1,7 +1,7 @@
/********************************************************************************
* include/time.h
*
* Copyright (C) 2007-2011, 2013-2014 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2011, 2013-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -80,7 +80,6 @@
#define CLOCK_REALTIME 0
/* Clock that cannot be set and represents monotonic time since some
* unspecified starting point. It is not affected by changes in the
* system time-of-day clock.
@ -104,35 +103,43 @@
/********************************************************************************
* Public Types
********************************************************************************/
/* Scalar types */
typedef uint32_t time_t; /* Holds time in seconds */
typedef uint8_t clockid_t; /* Identifies one time base source */
typedef FAR void *timer_t; /* Represents one POSIX timer */
/* struct timespec is the standard representation of time as seconds and
* nanoseconds.
*/
struct timespec
{
time_t tv_sec; /* Seconds */
long tv_nsec; /* Nanoseconds */
};
struct timeval
{
time_t tv_sec; /* Seconds */
long tv_usec; /* Microseconds */
};
/* struct tm is the standard representation for "broken out" time.
*
* REVISIT: This structure could be packed better using uint8_t's and
* uint16_t's. The standard definition does, however, call out type int for
* all of the members. NOTE: Any changes to this structure must be also be
* reflected in struct rtc_time defined in include/nuttx/rtc.h; these two
* structures must be cast compatible.
*/
struct tm
{
int tm_sec; /* second (0-61, allows for leap seconds) */
int tm_min; /* minute (0-59) */
int tm_hour; /* hour (0-23) */
int tm_mday; /* day of the month (1-31) */
int tm_mon; /* month (0-11) */
int tm_year; /* years since 1900 */
int tm_sec; /* Seconds (0-61, allows for leap seconds) */
int tm_min; /* Minutes (0-59) */
int tm_hour; /* Hours (0-23) */
int tm_mday; /* Day of the month (1-31) */
int tm_mon; /* Month (0-11) */
int tm_year; /* Years since 1900 */
#ifdef CONFIG_LIBC_LOCALTIME
int tm_wday; /* day of the week (0-6) */
int tm_yday; /* day of the year (0-365) */
int tm_isdst; /* non-0 if daylight savings time is in effect */
int tm_wday; /* Day of the week (0-6) */
int tm_yday; /* Day of the year (0-365) */
int tm_isdst; /* Non-0 if daylight savings time is in effect */
#endif
};
@ -161,7 +168,8 @@ struct sigevent;
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C" {
extern "C"
{
#else
#define EXTERN extern
#endif

View File

@ -40,7 +40,6 @@
#include <nuttx/config.h>
#include <sys/time.h>
#include <time.h>
#include <errno.h>
#include <nuttx/clock.h>

View File

@ -40,7 +40,6 @@
#include <nuttx/config.h>
#include <sys/time.h>
#include <time.h>
#include <errno.h>
#include <nuttx/clock.h>