summaryrefslogtreecommitdiffstats
path: root/libc/tzcode
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-07-25 11:55:59 -0700
committerElliott Hughes <enh@google.com>2014-07-25 12:03:51 -0700
commit905e6d58aaf515bf237e62078f8a321920fe4c6b (patch)
tree07ee9fad11490db7e30bc27e359d5d1adf950cef /libc/tzcode
parent123172ae370fe51e2d1fc26fe0aafa095af52919 (diff)
downloadbionic-905e6d58aaf515bf237e62078f8a321920fe4c6b.tar.gz
bionic-905e6d58aaf515bf237e62078f8a321920fe4c6b.tar.bz2
bionic-905e6d58aaf515bf237e62078f8a321920fe4c6b.zip
Start hiding "private/bionic_time.h".
Bug: 15765976 Change-Id: Ibd9cf07067ec8dffe9fda6c3d498d4ab90708220
Diffstat (limited to 'libc/tzcode')
-rw-r--r--libc/tzcode/localtime.c7
-rw-r--r--libc/tzcode/strftime.c37
2 files changed, 34 insertions, 10 deletions
diff --git a/libc/tzcode/localtime.c b/libc/tzcode/localtime.c
index 4dd7ab044..2e6804ed3 100644
--- a/libc/tzcode/localtime.c
+++ b/libc/tzcode/localtime.c
@@ -2293,7 +2293,8 @@ static int __bionic_tzload_cached(const char* name, struct state* const sp, cons
}
// Non-standard API: mktime(3) but with an explicit timezone parameter.
-time_t __attribute__((visibility("default"))) mktime_tz(struct tm* const tmp, const char* tz) {
+// This can't actually be hidden/removed until we fix MtpUtils.cpp
+__attribute__((visibility("default"))) time_t mktime_tz(struct tm* const tmp, const char* tz) {
struct state* st = malloc(sizeof(*st));
time_t return_value;
@@ -2310,7 +2311,8 @@ time_t __attribute__((visibility("default"))) mktime_tz(struct tm* const tmp, co
}
// Non-standard API: localtime(3) but with an explicit timezone parameter.
-void __attribute__((visibility("default"))) localtime_tz(const time_t* const timep, struct tm* tmp, const char* tz) {
+#if !defined(__LP64__)
+__attribute__((visibility("default"))) void localtime_tz(const time_t* const timep, struct tm* tmp, const char* tz) {
struct state* st = malloc(sizeof(*st));
if (st == NULL)
@@ -2322,5 +2324,6 @@ void __attribute__((visibility("default"))) localtime_tz(const time_t* const tim
localsub(timep, 0L, tmp, st);
free(st);
}
+#endif
// END android-added
diff --git a/libc/tzcode/strftime.c b/libc/tzcode/strftime.c
index f996f4841..c4ff19819 100644
--- a/libc/tzcode/strftime.c
+++ b/libc/tzcode/strftime.c
@@ -29,16 +29,38 @@
#include "locale.h"
#if __ANDROID__
-/* Android: struct lc_time_T is defined as strftime_locale in "bionic_time.h" */
-#include "private/bionic_time.h" /* for strftime_tz */
-#define lc_time_T strftime_locale
+
+/*
+ * This has an extra standalone_month array field compared to upstream.
+ * We only need to keep that if we leave the strftime_tz symbol exposed.
+ * Even then, this structure was never in an NDK header file.
+ */
+struct lc_time_T {
+ const char * mon[12];
+ const char * month[12];
+ const char * standalone_month[12];
+ const char * wday[7];
+ const char * weekday[7];
+ const char * X_fmt;
+ const char * x_fmt;
+ const char * c_fmt;
+ const char * am;
+ const char * pm;
+ const char * date_fmt;
+};
+
+/* LP32 had a 32-bit time_t, so we need to work around that here. */
#if defined(__LP64__)
#define time64_t time_t
#define mktime64 mktime
#else
#include <time64.h>
#endif
+
#include <ctype.h>
+
+size_t strftime_tz(char*, size_t, const char*, const struct tm*, const struct lc_time_T*);
+
#else // not __ANDROID__
struct lc_time_T {
const char * mon[MONSPERYEAR];
@@ -116,7 +138,7 @@ static const struct lc_time_T C_time_locale = {
static char * _add(const char *, char *, const char *, int);
static char * _conv(int, const char *, char *, const char *);
static char * _fmt(const char *, const struct tm *, char *, const char *,
- int *, const struct strftime_locale*);
+ int *, const struct lc_time_T*);
static char * _yconv(int, int, int, int, char *, const char *, int);
static char * getformat(int, char *, char *, char *, char *);
@@ -143,13 +165,12 @@ const struct tm * const t;
return strftime_tz(s, maxsize, format, t, Locale);
}
-size_t
-__attribute__((visibility("default"))) strftime_tz(s, maxsize, format, t, locale)
+__LIBC64_HIDDEN__ size_t strftime_tz(s, maxsize, format, t, locale)
char * const s;
const size_t maxsize;
const char * const format;
const struct tm * const t;
-const struct strftime_locale *locale;
+const struct lc_time_T *locale;
{
char * p;
int warn;
@@ -202,7 +223,7 @@ const struct tm * const t;
char * pt;
const char * const ptlim;
int * warnp;
-const struct strftime_locale* locale;
+const struct lc_time_T* locale;
{
for ( ; *format; ++format) {
if (*format == '%') {