Get Time As Second and MicroSecond Since 1970

Words
35
Reading
1 min
Listen
Play
5y

DTube video Link

#pragma comment(lib, "ntdll.lib")
#include 
#include 

DWORD64 GetTimeInMicroSecond(PLARGE_INTEGER crntTime)
{
    UINT64 tt;
    tt = crntTime->HighPart;
    tt <<= 32;
    tt |= crntTime->LowPart;
    return (tt/10)- 11644473600000000ULL;
}

// Get Time As Second and MicroSecond Since 1970
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
{
    LARGE_INTEGER crntTime;
    ULONG seconds = 0,second2;
    DWORD64 microSec;

    NtQuerySystemTime(&crntTime);
    RtlTimeToSecondsSince1970(&crntTime, &seconds);

    microSec = GetTimeInMicroSecond(&crntTime);
    second2 = microSec / 1000000;
    return 0;
}

Please Vote this post if you like it.
Please Follow me if you like my posts.
If you have any questions about this post, ask in comments.
Follow me on :
DTube

Get Time As Second and MicroSecond Since 1970 | Ecency