<time.h>: Add timegm(), timelocal() and others.
Add timegm(), timelocal(), time2posix() and posix2time() to the C library. Change-Id: I34d5771ed83dd994870a5ca58a511d01898b1ffb
This commit is contained in:
parent
23d24394e7
commit
6481b91520
@ -33,7 +33,7 @@
|
|||||||
*/
|
*/
|
||||||
#define HAS_GMTIME_R
|
#define HAS_GMTIME_R
|
||||||
#define HAS_LOCALTIME_R
|
#define HAS_LOCALTIME_R
|
||||||
/*#define HAS_TIMEGM */
|
#define HAS_TIMEGM
|
||||||
|
|
||||||
|
|
||||||
/* Details of non-standard tm struct elements.
|
/* Details of non-standard tm struct elements.
|
||||||
|
@ -9,6 +9,8 @@ Differences between current and Android 2.3:
|
|||||||
|
|
||||||
- <sys/cdefs.h>: Include <android/api-level.h>
|
- <sys/cdefs.h>: Include <android/api-level.h>
|
||||||
|
|
||||||
|
- <time.h>: Add timegm(), timelocal(), time2posix() and posix2time()
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Differences between Android 2.3 and Android 2.2:
|
Differences between Android 2.3 and Android 2.2:
|
||||||
|
|
||||||
|
@ -128,6 +128,11 @@ extern int timer_settime(timer_t timerid, int flags, const struct itimerspec *v
|
|||||||
extern int timer_gettime(timer_t timerid, struct itimerspec *value);
|
extern int timer_gettime(timer_t timerid, struct itimerspec *value);
|
||||||
extern int timer_getoverrun(timer_t timerid);
|
extern int timer_getoverrun(timer_t timerid);
|
||||||
|
|
||||||
|
extern time_t timelocal(struct tm *tm);
|
||||||
|
extern time_t timegm(struct tm* tm);
|
||||||
|
extern time_t time2posix(time_t ti);
|
||||||
|
extern time_t posix2time(time_t ti);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
#endif /* _TIME_H_ */
|
#endif /* _TIME_H_ */
|
||||||
|
@ -60,6 +60,14 @@ static char elsieid[] = "@(#)localtime.c 8.3";
|
|||||||
# define XLOG(x) do{}while (0)
|
# define XLOG(x) do{}while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Add the following function implementations:
|
||||||
|
* timelocal()
|
||||||
|
* timegm()
|
||||||
|
* time2posix()
|
||||||
|
* posix2time()
|
||||||
|
*/
|
||||||
|
#define STD_INSPIRED 1
|
||||||
|
|
||||||
/* THREAD-SAFETY SUPPORT GOES HERE */
|
/* THREAD-SAFETY SUPPORT GOES HERE */
|
||||||
static pthread_mutex_t _tzMutex = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t _tzMutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
@ -1509,7 +1517,7 @@ struct tm * tmp;
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef STD_INSPIRED
|
#ifdef STD_INSPIRED
|
||||||
|
#if 0 /* disabled because there is no good documentation for this function */
|
||||||
struct tm *
|
struct tm *
|
||||||
offtime(timep, offset)
|
offtime(timep, offset)
|
||||||
const time_t * const timep;
|
const time_t * const timep;
|
||||||
@ -1517,7 +1525,7 @@ const long offset;
|
|||||||
{
|
{
|
||||||
return gmtsub(timep, offset, &tmGlobal);
|
return gmtsub(timep, offset, &tmGlobal);
|
||||||
}
|
}
|
||||||
|
#endif /* 0 */
|
||||||
#endif /* defined STD_INSPIRED */
|
#endif /* defined STD_INSPIRED */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2106,6 +2114,7 @@ struct tm * const tmp;
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0 /* disable due to lack of clear documentation on this function */
|
||||||
time_t
|
time_t
|
||||||
timeoff(tmp, offset)
|
timeoff(tmp, offset)
|
||||||
struct tm * const tmp;
|
struct tm * const tmp;
|
||||||
@ -2120,6 +2129,7 @@ const long offset;
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
#endif /* 0 */
|
||||||
|
|
||||||
#endif /* defined STD_INSPIRED */
|
#endif /* defined STD_INSPIRED */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user