KDateTime::currentUtcDateTime()

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


Peter Kümmel wrote:
> 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
> 
> 

Shouldn't the windows specific code not be part of the KDateTime constructor?

Peter




More information about the kde-core-devel mailing list