修改系统默认时间

rk,mtk修改方案:

diff --git a/frameworks/base/services/java/com/android/server/SystemServer.java b/frameworks/base/services/java/com/android/server/SystemServer.java
index 8d23101f55..a0f4bbe553 100755
--- a/frameworks/base/services/java/com/android/server/SystemServer.java
+++ b/frameworks/base/services/java/com/android/server/SystemServer.java
@@ -145,7 +145,7 @@ public final class SystemServer {
 
     // The earliest supported time.  We pick one day into 1970, to
     // give any timezone code room without going into negative time.
-    private static final long EARLIEST_SUPPORTED_TIME = 86400 * 1000;
+    private static final long EARLIEST_SUPPORTED_TIME = 1535846400 * 1000;
 
     /*
      * Implementation class names. TODO: Move them to a codegen class or load
-- 

高通代码的修改方案:

diff --git a/vendor/qcom/proprietary/time-services/time_daemon_qmi.c b/vendor/qcom/proprietary/time-services/time_daemon_qmi.c
index 2e1ba1f..feb1b36 100755
--- a/vendor/qcom/proprietary/time-services/time_daemon_qmi.c
+++ b/vendor/qcom/proprietary/time-services/time_daemon_qmi.c
@@ -6,6 +6,7 @@
  * ---------------------------------------------------------------------------
  *
  */
+#define DEFAULT_TIME 1
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -204,7 +205,11 @@ static int genoff_post_init(time_genoff_ptr time_genoff)
                if (rc) {
                        TIME_LOGD("Daemon:%s:Error in accessing storage\n",
                                        __func__);
-                       time_genoff->generic_offset = 0;
+                       #if DEFAULT_TIME ///force system time = 2019/1/1=1546272000(date +%s --date 20190101)
+                               time_genoff->generic_offset = (uint64_t)SEC_TO_MSEC (1546272000) - time_genoff->generic_offset;
+                       #else
+                               time_genoff->generic_offset = 0;
+                       #endif
                }
        }
 

其中数值1546272000是通过命令"date +%s --date 20190101"生成的。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值