[LUGOS] Windows filetime -> time_t

Urban Purkat urban.purkat at hermes.si
Mon Aug 2 15:25:19 CEST 2004


> On Mon, 2 Aug 2004 13:38:20 +0200 , Urban Purkat <urban.purkat at hermes.si>
> wrote:
> > Zivjo!
> >
> > A kdo ve ce ze obstaja kaksna stvar, ki bi tole spremenila?
> >
> > MSDN says:
> > The FILETIME structure is a 64-bit value representing the number of
> > 100-nanosecond intervals since January 1, 1601.
> 
> Ce bi dokumentacija omenjala tudi casovni pas, v katerem je ta cas
> veljaven, bi bilo trivialno.

Tole je povedal Mr. Google:

Title: Converting a UNIX time_t to a Win32 FILETIME or SYSTEMTIME

UNIX maintains time in the form of a time_t, which represents
seconds since midnight, January 1, 1970, UTC.

Win32 maintains time primarily in the form of a FILETIME, which
represents 100-nanosecond intervals since January 1, 1601, UTC.

The following function converts a UNIX time_t to a Win32
FILETIME:

void UnixTimeToFileTime(time_t t, LPFILETIME pft)
{
    LONGLONG ll = Int32x32To64(t, 10000000) + 116444736000000000;
    pft->dwLowDateTime = (DWORD)ll;
    pft->dwHighDateTime = ll >> 32;
}

>From a FILETIME structure, other Win32 time formats can be
obtained, using functions such as FileTimeToDosDateTime and
FileTimeToSystemTime.

void UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst)
{
    FILETIME ft;
    UnixTimeToFileTime(t, &ft);
    FileTimeToSystemTime(&ft, pst);
}

Tko da bi se iz tega lahko znasel.

Malo me pa se bega: kaj je to filetime in systemtime?
A se sploh rabim ozirat na systemtime?

Lp, U



More information about the lugos-list mailing list