Remove mktime_tz.
Bug: http://b/15765976 Change-Id: Ifc8cd19ae621e611d66173ae927ef9a0445965c1
This commit is contained in:
@@ -2462,50 +2462,4 @@ static int __bionic_open_tzdata(const char* olson_id) {
|
||||
return fd;
|
||||
}
|
||||
|
||||
// Caches the most recent timezone (http://b/8270865).
|
||||
static int __bionic_tzload_cached(const char* name, struct state* const sp, const int doextend) {
|
||||
lock();
|
||||
|
||||
// Our single-item cache.
|
||||
static char* g_cached_time_zone_name;
|
||||
static struct state g_cached_time_zone;
|
||||
|
||||
// Do we already have this timezone cached?
|
||||
if (g_cached_time_zone_name != NULL && strcmp(name, g_cached_time_zone_name) == 0) {
|
||||
*sp = g_cached_time_zone;
|
||||
unlock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Can we load it?
|
||||
int rc = tzload(name, sp, doextend);
|
||||
if (rc == 0) {
|
||||
// Update the cache.
|
||||
free(g_cached_time_zone_name);
|
||||
g_cached_time_zone_name = strdup(name);
|
||||
g_cached_time_zone = *sp;
|
||||
}
|
||||
|
||||
unlock();
|
||||
return rc;
|
||||
}
|
||||
|
||||
// Non-standard API: mktime(3) but with an explicit timezone parameter.
|
||||
// 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;
|
||||
|
||||
if (st == NULL)
|
||||
return 0;
|
||||
if (__bionic_tzload_cached(tz, st, true) != 0) {
|
||||
// TODO: not sure what's best here, but for now, we fall back to gmt.
|
||||
gmtload(st);
|
||||
}
|
||||
|
||||
return_value = time1(tmp, localsub, st, 0L);
|
||||
free(st);
|
||||
return return_value;
|
||||
}
|
||||
|
||||
// END android-added
|
||||
|
||||
Reference in New Issue
Block a user