* commit 'ee9dea83fbaf2261066fbb20e5942c147018c949': bionic: tzset running hot
This commit is contained in:
commit
991a8a6bf7
@ -1211,7 +1211,9 @@ tzsetwall(void)
|
|||||||
settzname();
|
settzname();
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <sys/system_properties.h> // For __system_property_get.
|
#include <stdbool.h>
|
||||||
|
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
|
||||||
|
#include <sys/_system_properties.h> // For __system_property_serial.
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tzset_locked(void)
|
tzset_locked(void)
|
||||||
@ -1221,9 +1223,27 @@ tzset_locked(void)
|
|||||||
name = getenv("TZ");
|
name = getenv("TZ");
|
||||||
|
|
||||||
// try the "persist.sys.timezone" system property first
|
// try the "persist.sys.timezone" system property first
|
||||||
static char buf[PROP_VALUE_MAX];
|
if (name == NULL) {
|
||||||
if (name == NULL && __system_property_get("persist.sys.timezone", buf) > 0) {
|
static const prop_info *pi;
|
||||||
name = buf;
|
|
||||||
|
if (!pi) {
|
||||||
|
pi = __system_property_find("persist.sys.timezone");
|
||||||
|
}
|
||||||
|
if (pi) {
|
||||||
|
static char buf[PROP_VALUE_MAX];
|
||||||
|
static uint32_t s = -1;
|
||||||
|
static bool ok = false;
|
||||||
|
uint32_t serial;
|
||||||
|
|
||||||
|
serial = __system_property_serial(pi);
|
||||||
|
if (serial != s) {
|
||||||
|
ok = __system_property_read(pi, 0, buf) > 0;
|
||||||
|
s = serial;
|
||||||
|
}
|
||||||
|
if (ok) {
|
||||||
|
name = buf;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user