summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk4
-rw-r--r--twrp-functions.cpp4
2 files changed, 7 insertions, 1 deletions
diff --git a/Android.mk b/Android.mk
index f42f89119..4b11c8c12 100644
--- a/Android.mk
+++ b/Android.mk
@@ -366,7 +366,9 @@ ifneq ($(TW_DEFAULT_LANGUAGE),)
else
LOCAL_CFLAGS += -DTW_DEFAULT_LANGUAGE=en
endif
-
+ifneq ($(TW_CLOCK_OFFSET),)
+ LOCAL_CFLAGS += -DTW_CLOCK_OFFSET=$(TW_CLOCK_OFFSET)
+endif
LOCAL_ADDITIONAL_DEPENDENCIES += \
dump_image \
erase_image \
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index f82de6140..11e745b38 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -996,6 +996,10 @@ void TWFunc::Fixup_Time_On_Boot(const string& time_paths /* = "" */)
gettimeofday(&tv, NULL);
tv.tv_sec += offset/1000;
+#ifdef TW_CLOCK_OFFSET
+// Some devices are even quirkier and have ats files that are offset from the actual time
+ tv.tv_sec = tv.tv_sec + TW_CLOCK_OFFSET;
+#endif
tv.tv_usec += (offset%1000)*1000;
while (tv.tv_usec >= 1000000)