Adroid 2.1 architecture resolution 11 system time

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.