am 59ed029b: Merge "Upgrade to tzcode2013d."
* commit '59ed029b286a1564f635377296e4f088e0fd2afa': Upgrade to tzcode2013d.
This commit is contained in:
commit
f384be3b5c
@ -70,11 +70,6 @@ libc_common_src_files := \
|
|||||||
string/strtok.c \
|
string/strtok.c \
|
||||||
wchar/wcswidth.c \
|
wchar/wcswidth.c \
|
||||||
wchar/wcsxfrm.c \
|
wchar/wcsxfrm.c \
|
||||||
tzcode/asctime.c \
|
|
||||||
tzcode/difftime.c \
|
|
||||||
tzcode/localtime.c \
|
|
||||||
tzcode/strftime.c \
|
|
||||||
tzcode/strptime.c \
|
|
||||||
bionic/arc4random.c \
|
bionic/arc4random.c \
|
||||||
bionic/atoi.c \
|
bionic/atoi.c \
|
||||||
bionic/atol.c \
|
bionic/atol.c \
|
||||||
@ -247,6 +242,13 @@ libc_bionic_src_files := \
|
|||||||
bionic/wait.cpp \
|
bionic/wait.cpp \
|
||||||
bionic/wchar.cpp \
|
bionic/wchar.cpp \
|
||||||
|
|
||||||
|
libc_tzcode_src_files := \
|
||||||
|
tzcode/asctime.c \
|
||||||
|
tzcode/difftime.c \
|
||||||
|
tzcode/localtime.c \
|
||||||
|
tzcode/strftime.c \
|
||||||
|
tzcode/strptime.c \
|
||||||
|
|
||||||
libc_upstream_freebsd_src_files := \
|
libc_upstream_freebsd_src_files := \
|
||||||
upstream-freebsd/lib/libc/stdio/clrerr.c \
|
upstream-freebsd/lib/libc/stdio/clrerr.c \
|
||||||
upstream-freebsd/lib/libc/stdio/fclose.c \
|
upstream-freebsd/lib/libc/stdio/fclose.c \
|
||||||
@ -490,14 +492,6 @@ libc_common_cflags := \
|
|||||||
-DLOG_ON_HEAP_ERROR \
|
-DLOG_ON_HEAP_ERROR \
|
||||||
-Wall -Wextra
|
-Wall -Wextra
|
||||||
|
|
||||||
# these macro definitions are required to implement the
|
|
||||||
# 'timezone' and 'daylight' global variables, as well as
|
|
||||||
# properly update the 'tm_gmtoff' field in 'struct tm'.
|
|
||||||
#
|
|
||||||
libc_common_cflags += \
|
|
||||||
-DTM_GMTOFF=tm_gmtoff \
|
|
||||||
-DUSG_COMPAT=1
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
|
ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
|
||||||
libc_common_cflags += -DDEBUG
|
libc_common_cflags += -DDEBUG
|
||||||
endif
|
endif
|
||||||
@ -707,6 +701,28 @@ LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
|||||||
include $(BUILD_STATIC_LIBRARY)
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
|
|
||||||
|
|
||||||
|
# ========================================================
|
||||||
|
# libc_tzcode.a - upstream 'tzcode' code
|
||||||
|
# ========================================================
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := $(libc_tzcode_src_files)
|
||||||
|
LOCAL_CFLAGS := \
|
||||||
|
$(libc_common_cflags) \
|
||||||
|
-std=gnu99 \
|
||||||
|
-DSTD_INSPIRED=1 \
|
||||||
|
-DTZDIR=\"/system/usr/share/zoneinfo\" \
|
||||||
|
-DTM_GMTOFF=tm_gmtoff \
|
||||||
|
-DUSG_COMPAT=1
|
||||||
|
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
||||||
|
LOCAL_MODULE := libc_tzcode
|
||||||
|
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
||||||
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
||||||
|
|
||||||
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
|
|
||||||
|
|
||||||
# ========================================================
|
# ========================================================
|
||||||
# libc_freebsd.a - upstream FreeBSD C library code
|
# libc_freebsd.a - upstream FreeBSD C library code
|
||||||
# ========================================================
|
# ========================================================
|
||||||
@ -782,7 +798,12 @@ LOCAL_CFLAGS := $(libc_common_cflags) \
|
|||||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
||||||
LOCAL_MODULE := libc_common
|
LOCAL_MODULE := libc_common
|
||||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
||||||
LOCAL_WHOLE_STATIC_LIBRARIES := libbionic_ssp libc_bionic libc_freebsd libc_netbsd
|
LOCAL_WHOLE_STATIC_LIBRARIES := \
|
||||||
|
libbionic_ssp \
|
||||||
|
libc_bionic \
|
||||||
|
libc_freebsd \
|
||||||
|
libc_netbsd \
|
||||||
|
libc_tzcode
|
||||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
||||||
|
|
||||||
# TODO: split out the asflags.
|
# TODO: split out the asflags.
|
||||||
|
@ -9,12 +9,6 @@
|
|||||||
** whereas the output of asctime is supposed to be constant.
|
** whereas the output of asctime is supposed to be constant.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
#ifndef NOID
|
|
||||||
static char elsieid[] = "@(#)asctime.c 8.2";
|
|
||||||
#endif /* !defined NOID */
|
|
||||||
#endif /* !defined lint */
|
|
||||||
|
|
||||||
/*LINTLIBRARY*/
|
/*LINTLIBRARY*/
|
||||||
|
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
@ -75,9 +69,7 @@ static char buf_asctime[MAX_ASCTIME_BUF_SIZE];
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
char *
|
char *
|
||||||
asctime_r(timeptr, buf)
|
asctime_r(register const struct tm *timeptr, char *buf)
|
||||||
register const struct tm * timeptr;
|
|
||||||
char * buf;
|
|
||||||
{
|
{
|
||||||
static const char wday_name[][3] = {
|
static const char wday_name[][3] = {
|
||||||
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
||||||
@ -91,6 +83,10 @@ char * buf;
|
|||||||
char year[INT_STRLEN_MAXIMUM(int) + 2];
|
char year[INT_STRLEN_MAXIMUM(int) + 2];
|
||||||
char result[MAX_ASCTIME_BUF_SIZE];
|
char result[MAX_ASCTIME_BUF_SIZE];
|
||||||
|
|
||||||
|
if (timeptr == NULL) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return strcpy(buf, "??? ??? ?? ??:??:?? ????\n");
|
||||||
|
}
|
||||||
if (timeptr->tm_wday < 0 || timeptr->tm_wday >= DAYSPERWEEK)
|
if (timeptr->tm_wday < 0 || timeptr->tm_wday >= DAYSPERWEEK)
|
||||||
wn = "???";
|
wn = "???";
|
||||||
else wn = wday_name[timeptr->tm_wday];
|
else wn = wday_name[timeptr->tm_wday];
|
||||||
@ -113,10 +109,9 @@ char * buf;
|
|||||||
timeptr->tm_mday, timeptr->tm_hour,
|
timeptr->tm_mday, timeptr->tm_hour,
|
||||||
timeptr->tm_min, timeptr->tm_sec,
|
timeptr->tm_min, timeptr->tm_sec,
|
||||||
year);
|
year);
|
||||||
if (strlen(result) < STD_ASCTIME_BUF_SIZE || buf == buf_asctime) {
|
if (strlen(result) < STD_ASCTIME_BUF_SIZE || buf == buf_asctime)
|
||||||
(void) strcpy(buf, result);
|
return strcpy(buf, result);
|
||||||
return buf;
|
else {
|
||||||
} else {
|
|
||||||
#ifdef EOVERFLOW
|
#ifdef EOVERFLOW
|
||||||
errno = EOVERFLOW;
|
errno = EOVERFLOW;
|
||||||
#else /* !defined EOVERFLOW */
|
#else /* !defined EOVERFLOW */
|
||||||
@ -131,8 +126,7 @@ char * buf;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
char *
|
char *
|
||||||
asctime(timeptr)
|
asctime(register const struct tm *timeptr)
|
||||||
register const struct tm * timeptr;
|
|
||||||
{
|
{
|
||||||
return asctime_r(timeptr, buf_asctime);
|
return asctime_r(timeptr, buf_asctime);
|
||||||
}
|
}
|
||||||
|
@ -3,25 +3,16 @@
|
|||||||
** 1996-06-05 by Arthur David Olson.
|
** 1996-06-05 by Arthur David Olson.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
#ifndef NOID
|
|
||||||
static char elsieid[] = "@(#)difftime.c 8.1";
|
|
||||||
#endif /* !defined NOID */
|
|
||||||
#endif /* !defined lint */
|
|
||||||
|
|
||||||
/*LINTLIBRARY*/
|
/*LINTLIBRARY*/
|
||||||
|
|
||||||
#include "private.h" /* for time_t, TYPE_INTEGRAL, and TYPE_SIGNED */
|
#include "private.h" /* for time_t, TYPE_INTEGRAL, and TYPE_SIGNED */
|
||||||
|
|
||||||
double
|
double ATTRIBUTE_CONST
|
||||||
difftime(time1, time0)
|
difftime(const time_t time1, const time_t time0)
|
||||||
const time_t time1;
|
|
||||||
const time_t time0;
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
** If (sizeof (double) > sizeof (time_t)) simply convert and subtract
|
** If (sizeof (double) > sizeof (time_t)) simply convert and subtract
|
||||||
** (assuming that the larger type has more precision).
|
** (assuming that the larger type has more precision).
|
||||||
** This is the common real-world case circa 2004.
|
|
||||||
*/
|
*/
|
||||||
if (sizeof (double) > sizeof (time_t))
|
if (sizeof (double) > sizeof (time_t))
|
||||||
return (double) time1 - (double) time0;
|
return (double) time1 - (double) time0;
|
||||||
@ -39,7 +30,7 @@ const time_t time0;
|
|||||||
*/
|
*/
|
||||||
if (time1 >= time0)
|
if (time1 >= time0)
|
||||||
return time1 - time0;
|
return time1 - time0;
|
||||||
else return -((double) (time0 - time1));
|
else return -(double) (time0 - time1);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
** time_t is integral and signed.
|
** time_t is integral and signed.
|
||||||
@ -50,16 +41,16 @@ const time_t time0;
|
|||||||
return time1 - time0;
|
return time1 - time0;
|
||||||
/*
|
/*
|
||||||
** time1 and time0 have opposite signs.
|
** time1 and time0 have opposite signs.
|
||||||
** Punt if unsigned long is too narrow.
|
** Punt if uintmax_t is too narrow.
|
||||||
|
** This suffers from double rounding; attempt to lessen that
|
||||||
|
** by using long double temporaries.
|
||||||
*/
|
*/
|
||||||
if (sizeof (unsigned long) < sizeof (time_t))
|
if (sizeof (uintmax_t) < sizeof (time_t))
|
||||||
return (double) time1 - (double) time0;
|
return (long double) time1 - (long double) time0;
|
||||||
/*
|
/*
|
||||||
** Stay calm...decent optimizers will eliminate the complexity below.
|
** Stay calm...decent optimizers will eliminate the complexity below.
|
||||||
*/
|
*/
|
||||||
if (time1 >= 0 /* && time0 < 0 */)
|
if (time1 >= 0 /* && time0 < 0 */)
|
||||||
return (unsigned long) time1 +
|
return (uintmax_t) time1 + (uintmax_t) (-1 - time0) + 1;
|
||||||
(unsigned long) (-(time0 + 1)) + 1;
|
return -(double) ((uintmax_t) time0 + (uintmax_t) (-1 - time1) + 1);
|
||||||
return -(double) ((unsigned long) time0 +
|
|
||||||
(unsigned long) (-(time1 + 1)) + 1);
|
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -15,16 +15,6 @@
|
|||||||
** Thank you!
|
** Thank you!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
** ID
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
#ifndef NOID
|
|
||||||
static char privatehid[] = "@(#)private.h 8.2";
|
|
||||||
#endif /* !defined NOID */
|
|
||||||
#endif /* !defined lint */
|
|
||||||
|
|
||||||
#define GRANDPARENTED "Local time zone must be set--see zic manual page"
|
#define GRANDPARENTED "Local time zone must be set--see zic manual page"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -48,10 +38,6 @@ static char privatehid[] = "@(#)private.h 8.2";
|
|||||||
#define HAVE_SETTIMEOFDAY 3
|
#define HAVE_SETTIMEOFDAY 3
|
||||||
#endif /* !defined HAVE_SETTIMEOFDAY */
|
#endif /* !defined HAVE_SETTIMEOFDAY */
|
||||||
|
|
||||||
#ifndef HAVE_STRERROR
|
|
||||||
#define HAVE_STRERROR 1
|
|
||||||
#endif /* !defined HAVE_STRERROR */
|
|
||||||
|
|
||||||
#ifndef HAVE_SYMLINK
|
#ifndef HAVE_SYMLINK
|
||||||
#define HAVE_SYMLINK 1
|
#define HAVE_SYMLINK 1
|
||||||
#endif /* !defined HAVE_SYMLINK */
|
#endif /* !defined HAVE_SYMLINK */
|
||||||
@ -72,6 +58,10 @@ static char privatehid[] = "@(#)private.h 8.2";
|
|||||||
#define HAVE_UTMPX_H 0
|
#define HAVE_UTMPX_H 0
|
||||||
#endif /* !defined HAVE_UTMPX_H */
|
#endif /* !defined HAVE_UTMPX_H */
|
||||||
|
|
||||||
|
#ifndef LOCALE_HOME
|
||||||
|
#define LOCALE_HOME "/usr/lib/locale"
|
||||||
|
#endif /* !defined LOCALE_HOME */
|
||||||
|
|
||||||
#if HAVE_INCOMPATIBLE_CTIME_R
|
#if HAVE_INCOMPATIBLE_CTIME_R
|
||||||
#define asctime_r _incompatible_asctime_r
|
#define asctime_r _incompatible_asctime_r
|
||||||
#define ctime_r _incompatible_ctime_r
|
#define ctime_r _incompatible_ctime_r
|
||||||
@ -105,17 +95,15 @@ static char privatehid[] = "@(#)private.h 8.2";
|
|||||||
#endif /* !defined WEXITSTATUS */
|
#endif /* !defined WEXITSTATUS */
|
||||||
|
|
||||||
#if HAVE_UNISTD_H
|
#if HAVE_UNISTD_H
|
||||||
#include "unistd.h" /* for F_OK and R_OK */
|
#include "unistd.h" /* for F_OK, R_OK, and other POSIX goodness */
|
||||||
#endif /* HAVE_UNISTD_H */
|
#endif /* HAVE_UNISTD_H */
|
||||||
|
|
||||||
#if !HAVE_UNISTD_H
|
|
||||||
#ifndef F_OK
|
#ifndef F_OK
|
||||||
#define F_OK 0
|
#define F_OK 0
|
||||||
#endif /* !defined F_OK */
|
#endif /* !defined F_OK */
|
||||||
#ifndef R_OK
|
#ifndef R_OK
|
||||||
#define R_OK 4
|
#define R_OK 4
|
||||||
#endif /* !defined R_OK */
|
#endif /* !defined R_OK */
|
||||||
#endif /* !HAVE_UNISTD_H */
|
|
||||||
|
|
||||||
/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
|
/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
|
||||||
#define is_digit(c) ((unsigned)(c) - '0' <= 9)
|
#define is_digit(c) ((unsigned)(c) - '0' <= 9)
|
||||||
@ -136,19 +124,65 @@ static char privatehid[] = "@(#)private.h 8.2";
|
|||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
#endif /* !HAVE_STDINT_H */
|
#endif /* !HAVE_STDINT_H */
|
||||||
|
|
||||||
|
#ifndef HAVE_INTTYPES_H
|
||||||
|
# define HAVE_INTTYPES_H HAVE_STDINT_H
|
||||||
|
#endif
|
||||||
|
#if HAVE_INTTYPES_H
|
||||||
|
# include <inttypes.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef INT_FAST64_MAX
|
#ifndef INT_FAST64_MAX
|
||||||
/* Pre-C99 GCC compilers define __LONG_LONG_MAX__ instead of LLONG_MAX. */
|
/* Pre-C99 GCC compilers define __LONG_LONG_MAX__ instead of LLONG_MAX. */
|
||||||
#if defined LLONG_MAX || defined __LONG_LONG_MAX__
|
#if defined LLONG_MAX || defined __LONG_LONG_MAX__
|
||||||
typedef long long int_fast64_t;
|
typedef long long int_fast64_t;
|
||||||
|
# ifdef LLONG_MAX
|
||||||
|
# define INT_FAST64_MIN LLONG_MIN
|
||||||
|
# define INT_FAST64_MAX LLONG_MAX
|
||||||
|
# else
|
||||||
|
# define INT_FAST64_MIN __LONG_LONG_MIN__
|
||||||
|
# define INT_FAST64_MAX __LONG_LONG_MAX__
|
||||||
|
# endif
|
||||||
|
# define SCNdFAST64 "lld"
|
||||||
#else /* ! (defined LLONG_MAX || defined __LONG_LONG_MAX__) */
|
#else /* ! (defined LLONG_MAX || defined __LONG_LONG_MAX__) */
|
||||||
#if (LONG_MAX >> 31) < 0xffffffff
|
#if (LONG_MAX >> 31) < 0xffffffff
|
||||||
Please use a compiler that supports a 64-bit integer type (or wider);
|
Please use a compiler that supports a 64-bit integer type (or wider);
|
||||||
you may need to compile with "-DHAVE_STDINT_H".
|
you may need to compile with "-DHAVE_STDINT_H".
|
||||||
#endif /* (LONG_MAX >> 31) < 0xffffffff */
|
#endif /* (LONG_MAX >> 31) < 0xffffffff */
|
||||||
typedef long int_fast64_t;
|
typedef long int_fast64_t;
|
||||||
|
# define INT_FAST64_MIN LONG_MIN
|
||||||
|
# define INT_FAST64_MAX LONG_MAX
|
||||||
|
# define SCNdFAST64 "ld"
|
||||||
#endif /* ! (defined LLONG_MAX || defined __LONG_LONG_MAX__) */
|
#endif /* ! (defined LLONG_MAX || defined __LONG_LONG_MAX__) */
|
||||||
#endif /* !defined INT_FAST64_MAX */
|
#endif /* !defined INT_FAST64_MAX */
|
||||||
|
|
||||||
|
#ifndef INT_FAST32_MAX
|
||||||
|
# if INT_MAX >> 31 == 0
|
||||||
|
typedef long int_fast32_t;
|
||||||
|
# else
|
||||||
|
typedef int int_fast32_t;
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INTMAX_MAX
|
||||||
|
# if defined LLONG_MAX || defined __LONG_LONG_MAX__
|
||||||
|
typedef long long intmax_t;
|
||||||
|
# define PRIdMAX "lld"
|
||||||
|
# else
|
||||||
|
typedef long intmax_t;
|
||||||
|
# define PRIdMAX "ld"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UINTMAX_MAX
|
||||||
|
# if defined ULLONG_MAX || defined __LONG_LONG_MAX__
|
||||||
|
typedef unsigned long long uintmax_t;
|
||||||
|
# define PRIuMAX "llu"
|
||||||
|
# else
|
||||||
|
typedef unsigned long uintmax_t;
|
||||||
|
# define PRIuMAX "lu"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef INT32_MAX
|
#ifndef INT32_MAX
|
||||||
#define INT32_MAX 0x7fffffff
|
#define INT32_MAX 0x7fffffff
|
||||||
#endif /* !defined INT32_MAX */
|
#endif /* !defined INT32_MAX */
|
||||||
@ -156,74 +190,30 @@ typedef long int_fast64_t;
|
|||||||
#define INT32_MIN (-1 - INT32_MAX)
|
#define INT32_MIN (-1 - INT32_MAX)
|
||||||
#endif /* !defined INT32_MIN */
|
#endif /* !defined INT32_MIN */
|
||||||
|
|
||||||
|
#if 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
|
||||||
|
# define ATTRIBUTE_CONST __attribute__ ((const))
|
||||||
|
# define ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||||
|
#else
|
||||||
|
# define ATTRIBUTE_CONST /* empty */
|
||||||
|
# define ATTRIBUTE_PURE /* empty */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined _Noreturn && __STDC_VERSION__ < 201112
|
||||||
|
# if 2 < __GNUC__ + (8 <= __GNUC_MINOR__)
|
||||||
|
# define _Noreturn __attribute__ ((__noreturn__))
|
||||||
|
# else
|
||||||
|
# define _Noreturn
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __STDC_VERSION__ < 199901 && !defined restrict
|
||||||
|
# define restrict /* empty */
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Workarounds for compilers/systems.
|
** Workarounds for compilers/systems.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
** If your compiler lacks prototypes, "#define P(x) ()".
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef P
|
|
||||||
#define P(x) x
|
|
||||||
#endif /* !defined P */
|
|
||||||
|
|
||||||
/*
|
|
||||||
** SunOS 4.1.1 headers lack EXIT_SUCCESS.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef EXIT_SUCCESS
|
|
||||||
#define EXIT_SUCCESS 0
|
|
||||||
#endif /* !defined EXIT_SUCCESS */
|
|
||||||
|
|
||||||
/*
|
|
||||||
** SunOS 4.1.1 headers lack EXIT_FAILURE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef EXIT_FAILURE
|
|
||||||
#define EXIT_FAILURE 1
|
|
||||||
#endif /* !defined EXIT_FAILURE */
|
|
||||||
|
|
||||||
/*
|
|
||||||
** SunOS 4.1.1 headers lack FILENAME_MAX.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef FILENAME_MAX
|
|
||||||
|
|
||||||
#ifndef MAXPATHLEN
|
|
||||||
#ifdef unix
|
|
||||||
#include "sys/param.h"
|
|
||||||
#endif /* defined unix */
|
|
||||||
#endif /* !defined MAXPATHLEN */
|
|
||||||
|
|
||||||
#ifdef MAXPATHLEN
|
|
||||||
#define FILENAME_MAX MAXPATHLEN
|
|
||||||
#endif /* defined MAXPATHLEN */
|
|
||||||
#ifndef MAXPATHLEN
|
|
||||||
#define FILENAME_MAX 1024 /* Pure guesswork */
|
|
||||||
#endif /* !defined MAXPATHLEN */
|
|
||||||
|
|
||||||
#endif /* !defined FILENAME_MAX */
|
|
||||||
|
|
||||||
/*
|
|
||||||
** SunOS 4.1.1 libraries lack remove.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef remove
|
|
||||||
extern int unlink P((const char * filename));
|
|
||||||
#define remove unlink
|
|
||||||
#endif /* !defined remove */
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Some ancient errno.h implementations don't declare errno.
|
|
||||||
** But some newer errno.h implementations define it as a macro.
|
|
||||||
** Fix the former without affecting the latter.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef errno
|
|
||||||
extern int errno;
|
|
||||||
#endif /* !defined errno */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Some time.h implementations don't declare asctime_r.
|
** Some time.h implementations don't declare asctime_r.
|
||||||
** Others might define it as a macro.
|
** Others might define it as a macro.
|
||||||
@ -231,21 +221,68 @@ extern int errno;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef asctime_r
|
#ifndef asctime_r
|
||||||
extern char * asctime_r();
|
extern char * asctime_r(struct tm const *, char *);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Compile with -Dtime_tz=T to build the tz package with a private
|
||||||
|
** time_t type equivalent to T rather than the system-supplied time_t.
|
||||||
|
** This debugging feature can test unusual design decisions
|
||||||
|
** (e.g., time_t wider than 'long', or unsigned time_t) even on
|
||||||
|
** typical platforms.
|
||||||
|
*/
|
||||||
|
#ifdef time_tz
|
||||||
|
static time_t sys_time(time_t *x) { return time(x); }
|
||||||
|
|
||||||
|
# undef ctime
|
||||||
|
# define ctime tz_ctime
|
||||||
|
# undef ctime_r
|
||||||
|
# define ctime_r tz_ctime_r
|
||||||
|
# undef difftime
|
||||||
|
# define difftime tz_difftime
|
||||||
|
# undef gmtime
|
||||||
|
# define gmtime tz_gmtime
|
||||||
|
# undef gmtime_r
|
||||||
|
# define gmtime_r tz_gmtime_r
|
||||||
|
# undef localtime
|
||||||
|
# define localtime tz_localtime
|
||||||
|
# undef localtime_r
|
||||||
|
# define localtime_r tz_localtime_r
|
||||||
|
# undef mktime
|
||||||
|
# define mktime tz_mktime
|
||||||
|
# undef time
|
||||||
|
# define time tz_time
|
||||||
|
# undef time_t
|
||||||
|
# define time_t tz_time_t
|
||||||
|
|
||||||
|
typedef time_tz time_t;
|
||||||
|
|
||||||
|
char *ctime(time_t const *);
|
||||||
|
char *ctime_r(time_t const *, char *);
|
||||||
|
double difftime(time_t, time_t);
|
||||||
|
struct tm *gmtime(time_t const *);
|
||||||
|
struct tm *gmtime_r(time_t const *restrict, struct tm *restrict);
|
||||||
|
struct tm *localtime(time_t const *);
|
||||||
|
struct tm *localtime_r(time_t const *restrict, struct tm *restrict);
|
||||||
|
time_t mktime(struct tm *);
|
||||||
|
|
||||||
|
static time_t
|
||||||
|
time(time_t *p)
|
||||||
|
{
|
||||||
|
time_t r = sys_time(0);
|
||||||
|
if (p)
|
||||||
|
*p = r;
|
||||||
|
return r;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Private function declarations.
|
** Private function declarations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char * icalloc P((int nelem, int elsize));
|
char * icatalloc(char * old, const char * new);
|
||||||
char * icatalloc P((char * old, const char * new));
|
char * icpyalloc(const char * string);
|
||||||
char * icpyalloc P((const char * string));
|
const char * scheck(const char * string, const char * format);
|
||||||
char * imalloc P((int n));
|
|
||||||
void * irealloc P((void * pointer, int size));
|
|
||||||
void icfree P((char * pointer));
|
|
||||||
void ifree P((char * pointer));
|
|
||||||
const char * scheck P((const char * string, const char * format));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Finally, some convenience items.
|
** Finally, some convenience items.
|
||||||
@ -333,8 +370,8 @@ const char * scheck P((const char * string, const char * format));
|
|||||||
#if HAVE_INCOMPATIBLE_CTIME_R
|
#if HAVE_INCOMPATIBLE_CTIME_R
|
||||||
#undef asctime_r
|
#undef asctime_r
|
||||||
#undef ctime_r
|
#undef ctime_r
|
||||||
char *asctime_r P((struct tm const *, char *));
|
char *asctime_r(struct tm const *, char *);
|
||||||
char *ctime_r P((time_t const *, char *));
|
char *ctime_r(time_t const *, char *);
|
||||||
#endif /* HAVE_INCOMPATIBLE_CTIME_R */
|
#endif /* HAVE_INCOMPATIBLE_CTIME_R */
|
||||||
|
|
||||||
#ifndef YEARSPERREPEAT
|
#ifndef YEARSPERREPEAT
|
||||||
|
@ -111,12 +111,12 @@ static const struct lc_time_T C_time_locale = {
|
|||||||
"%a %b %e %H:%M:%S %Z %Y"
|
"%a %b %e %H:%M:%S %Z %Y"
|
||||||
};
|
};
|
||||||
|
|
||||||
static char * _add P((const char *, char *, const char *, int));
|
static char * _add(const char *, char *, const char *, int);
|
||||||
static char * _conv P((int, const char *, char *, const char *));
|
static char * _conv(int, const char *, char *, const char *);
|
||||||
static char * _fmt P((const char *, const struct tm *, char *, const char *,
|
static char * _fmt(const char *, const struct tm *, char *, const char *,
|
||||||
int *, const struct strftime_locale*));
|
int *, const struct strftime_locale*);
|
||||||
static char * _yconv P((int, int, int, int, char *, const char *, int));
|
static char * _yconv(int, int, int, int, char *, const char *, int);
|
||||||
static char * getformat P((int, char *, char *, char *, char *));
|
static char * getformat(int, char *, char *, char *, char *);
|
||||||
|
|
||||||
extern char * tzname[];
|
extern char * tzname[];
|
||||||
|
|
||||||
|
@ -15,22 +15,12 @@
|
|||||||
** Thank you!
|
** Thank you!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
** ID
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
#ifndef NOID
|
|
||||||
static char tzfilehid[] = "@(#)tzfile.h 8.1";
|
|
||||||
#endif /* !defined NOID */
|
|
||||||
#endif /* !defined lint */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Information about time zone files.
|
** Information about time zone files.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TZDIR
|
#ifndef TZDIR
|
||||||
#define TZDIR "/system/usr/share/zoneinfo" /* Time zone object file directory */
|
#define TZDIR "/usr/local/etc/zoneinfo" /* Time zone object file directory */
|
||||||
#endif /* !defined TZDIR */
|
#endif /* !defined TZDIR */
|
||||||
|
|
||||||
#ifndef TZDEFAULT
|
#ifndef TZDEFAULT
|
||||||
@ -132,7 +122,7 @@ struct tzhead {
|
|||||||
#define DAYSPERNYEAR 365
|
#define DAYSPERNYEAR 365
|
||||||
#define DAYSPERLYEAR 366
|
#define DAYSPERLYEAR 366
|
||||||
#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR)
|
#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR)
|
||||||
#define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY)
|
#define SECSPERDAY ((int_fast32_t) SECSPERHOUR * HOURSPERDAY)
|
||||||
#define MONSPERYEAR 12
|
#define MONSPERYEAR 12
|
||||||
|
|
||||||
#define TM_SUNDAY 0
|
#define TM_SUNDAY 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user