HalpQueryVirtualRtc

NTSTATUS __stdcall HalpQueryVirtualRtc(_LARGE_INTEGER *CurrentTime, UINT8 *RtcValid){
  __int64 v4; 
  UINT64 v5; 
  _LARGE_INTEGER v6; 
  LONGLONG v7; 
  __int16 v9[20]; 
  _LARGE_INTEGER PerformanceFrequency; 
  _LARGE_INTEGER v11; 

  PerformanceFrequency.QuadPart = 0i64;
  *(_OWORD *)v9 = 0i64;
  if( dword_140C49D0C == 2 )
    goto LABEL_8;
  while( 1 )
  {
    v4 = qword_140C4A380;
    v11.QuadPart = qword_140C4A38C;
    v5 = KeQueryPerformanceCounter(&PerformanceFrequency);
    if( v4 == qword_140C4A398 )
      break;
    _mm_pause();
  }
  RtlpTimeToTimeFields(&v11, v9, v6);
  LODWORD(v7) = 1601;
  if( v9[0] <= 1601 )
  {
LABEL_8:
    LOBYTE(v7) = 0;
  }
  else
  {
    v7 = v11.QuadPart + (__int64)(10000000 * (v5 - v4)) / PerformanceFrequency.QuadPart;
    CurrentTime->QuadPart = v7;
    if( RtcValid )
      *RtcValid = byte_140C4A3A4 == 0;
    LOBYTE(v7) = 1;
  }
  return v7;
}

Referenced by:

HalCalibratePerformanceCounter
HalQueryRealTimeClock
HalpSetResumeTime