11 system time 11.1 Time Operation
File: Frameworks/base/CORE/Java/Android/OS/systemclock. Java
Native public static Boolean setcurrenttimemillis (long millis );
Switch to the following file
File: Frameworks/base/CORE/JNI/android_ OS _systemclock.cpp
Static jboolean android_ OS _systemclock_setcurrenttimemillis (jnienv * ENV,
Jobject clazz, jlong millis)
{
Return (setcurrenttimemillis (millis) = 0 );
}
Switch to the following file
File: Frameworks/base/libs/utils/systemclock. cpp
Int setcurrenttimemillis (int64_t millis)
{
...
# If have_android_ OS
FD = open ("/dev/alarm", o_rdwr );
If (FD <0 ){
Logw ("unable to open alarm DRIVER: % s/n", strerror (errno ));
Return-1;
}
TS. TV _sec = TV. TV _sec;
TS. TV _nsec = TV. TV _usec * 1000;
Res = IOCTL (FD, android_alarm_set_rtc, & TS );
If (RES <0 ){
Logw ("unable to set RTC to % ld: % s/n", TV. TV _sec, strerror (errno ));
Ret =-1;
}
Close (FD );
# Else
...
}
That is, to operate the device/dev/alarm