ChessUSA.com TalkChess.com
Hosted by Your Move Chess & Games
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CPU time in Windows
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions Flat
View previous topic :: View next topic  
Author Message
Daniel Shawul



Joined: 14 Mar 2006
Posts: 3051
Location: Ethiopia

PostPost subject: Re: CPU time in Windows    Posted: Sun Feb 19, 2012 5:16 pm Reply to topic Reply with quote

Quote:

Actually that page is even more confusing, as it talks about "processing times" as well.

That page is consistent with msvc implementation. OTOH glibc's implementation is weird for me.
Code:

/***
*clock_t clock() - Return the processor time used by this process.
*
*Purpose:
*       This routine calculates how much time the calling process
*       has used.  At startup time, startup calls __inittime which stores
*       the initial time.  The clock routine calculates the difference
*       between the current time and the initial time.
*
*       Clock must reference _cinitime so that _cinitim.asm gets linked in.
*       That routine, in turn, puts __inittime in the startup initialization
*       routine table.
*
*Entry:
*       No parameters.
*       itime is a static structure of type timeb.
*
*Exit:
*       If successful, clock returns the number of CLK_TCKs (milliseconds)
*       that have elapsed.  If unsuccessful, clock returns -1.
*
*Exceptions:
*       None.
*
*******************************************************************************/

clock_t __cdecl clock (
        void
        )
{
        unsigned __int64 current_tics;
        FILETIME ct;

        GetSystemTimeAsFileTime( &ct );

        current_tics = (unsigned __int64)ct.dwLowDateTime +
                       (((unsigned __int64)ct.dwHighDateTime) << 32);

        /* calculate the elapsed number of 100 nanosecond units */
        current_tics -= start_tics;

        /* return number of elapsed milliseconds */
        return (clock_t)(current_tics / 10000);
}

_________________
https://sites.google.com/site/dshawul/
https://github.com/dshawul
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Display posts from previous:   
Subject Author Date/Time
CPU time in Windows H.G.Muller Mon Feb 13, 2012 6:18 pm
      Re: CPU time in Windows Jim Ablett Mon Feb 13, 2012 6:50 pm
            Re: CPU time in Windows H.G.Muller Mon Feb 13, 2012 7:27 pm
                  Re: CPU time in Windows Jim Ablett Tue Feb 14, 2012 1:11 am
      Re: CPU time in Windows Jim Ablett Tue Feb 14, 2012 11:34 am
            Re: CPU time in Windows Daniel Shawul Tue Feb 14, 2012 12:41 pm
                  Re: CPU time in Windows Ricardo Barreira Sun Feb 19, 2012 1:07 pm
                        Re: CPU time in Windows Daniel Shawul Sun Feb 19, 2012 5:16 pm
            Re: CPU time in Windows H.G.Muller Sun Feb 19, 2012 12:17 pm
      Re: CPU time in Windows Jim Ablett Sun Feb 19, 2012 12:43 pm
            Re: CPU time in Windows H.G.Muller Sun Feb 19, 2012 1:00 pm
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Powered by phpBB © 2001, 2005 phpBB Group
Enhanced with Moby Threads