KDateTime::currentUtcDateTime()

Peter Kümmel syntheticpp at gmx.net
Thu Jul 27 18:00:56 BST 2006


Why could we not also use the unix code on windows?
No problem with compiling.

KDateTime KDateTime::currentUtcDateTime()
{
#ifdef Q_OS_WIN
    memset(&st, 0, sizeof(SYSTEMTIME));
    GetSystemTime(&st);
    return KDateTime(QDate(st.wYear, st.wMonth, st.wDay),
                     QTime(st.wHour, st.wMinute, st.wSecond, st.wMilliseconds),
                     Spec(UTC));
#else
    time_t t;
    ::time(&t);
    KDateTime result;
    result.setTime_t(static_cast<uint>(t));
    return result;
#endif
}

Peter




More information about the kde-core-devel mailing list