|
|
@@ -8,6 +8,7 @@ import android.content.Context
|
|
|
import android.content.Intent
|
|
|
import android.content.pm.PackageManager
|
|
|
import android.os.Build
|
|
|
+import android.os.SystemClock
|
|
|
import android.provider.Settings
|
|
|
import android.text.TextUtils
|
|
|
import android.util.Log
|
|
|
@@ -198,6 +199,7 @@ suspend fun syncTime() {
|
|
|
dateHeader,
|
|
|
DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss z", Locale.ENGLISH)
|
|
|
)
|
|
|
+ val timeMillis = date.toInstant().toEpochMilli()
|
|
|
// convert to Asia/Shanghai
|
|
|
val dateInZone = date.withZoneSameInstant(ZoneId.of("Asia/Shanghai"))
|
|
|
Log.i(
|
|
|
@@ -209,7 +211,7 @@ suspend fun syncTime() {
|
|
|
"settings put global auto_time 1",
|
|
|
"settings put global auto_time_zone 0",
|
|
|
"service call alarm 3 s16 Asia/Shanghai",
|
|
|
- "date \"${dateInZone.format(DateTimeFormatter.ofPattern("MMddHHmmyyyy.ss"))}\""
|
|
|
+ "service call alarm 2 i64 $timeMillis"
|
|
|
)
|
|
|
} catch (e: Exception) {
|
|
|
Log.e(systemTag, "Error SyncTime", e)
|