How to Solve Android Linux5.10 Kernel do_gettimeofday Function Error

Android Linux 5.10 kernel do_gettimeofday function prompt does not exist.

Solution: Replace with ktime_get_real_ts64 function.

Specific examples:

Code before modification:

    struct  timeval   time_now;
	struct rtc_time tm; 
    do_gettimeofday(&time_now);
	rtc_time_to_tm(time_now.tv_sec, &tm); 

Code after modification:

	struct timespec64 ts64;
	struct rtc_time tm; 
    ktime_get_real_ts64(&ts64);
	tm = rtc_ktime_to_tm(ts64.tv_sec); 

Read More: