Partager via


Interpreting Event Timestamps (Windows CE 5.0)

Send Feedback

The following sample code shows how you can convert an event timestamp into standard units and display it.

void PrintTimeStamp(
    DWORD dwTimeStamp,   // Timestamp from event header
    DWORD dwFrequency    // Timer frequency from CELID_LOG_MARKER event
    )
{
 __int64 iVal;
    DWORD dwHours, dwMinutes, dwSeconds, dwMilli, dwMicro;

    iVal = (__int64) dwTimeStamp * 1000000;
    iVal = iVal / dwFrequency;

    dwMicro   = (DWORD) ((iVal / (1))                    % 1000);
    dwMilli   = (DWORD) ((iVal / (1000))                 % 1000);
    dwSeconds = (DWORD) ((iVal / (1000 * 1000))          % 60);
    dwMinutes = (DWORD) ((iVal / (1000 * 1000 * 60))     % 60);
    dwHours   = (DWORD) ((iVal / ((__int64) 1000 * 1000 * 60 * 60)));

    printf(TEXT("%2d:%02d:%02d.%03d.%03d"),
           dwHours, dwMinutes, dwSeconds, dwMilli, dwMicro);
}

See Also

CeLog Event Format

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.