GetCurrentDateTime()

#include <windows.h>

static Windows::Foundation::DateTime GetCurrentDateTime() {
    // Get the current system time
    SYSTEMTIME st;
    GetSystemTime(&st);

    // Convert it to something DateTime will understand
    FILETIME ft;
    SystemTimeToFileTime(&st, &ft);

    // Conversion to DateTime's long long is done vie ULARGE_INTEGER
    ULARGE_INTEGER ui;
    ui.LowPart = ft.dwLowDateTime;
    ui.HighPart = ft.dwHighDateTime;

    DateTime currentDateTime;
    currentDateTime.UniversalTime = ui.QuadPart;
    return currentDateTime;
}