lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> On Nov 9, 2019, at 10:16 AM, Viacheslav Usov <> wrote:
> (begin quote)
> Product Version(s): 5.10   |  5.10
> Operating System:   MS-DOS |  OS/2
> Flags: ENDUSER | S_QuickC S_QuickAsm docsup
> Last Modified: 17-JUL-1990    ArticleIdent: Q49729
> The clock function is documented as telling how much processor time
> has been used by the calling process. This definition is misleading.
> The clock function returns a clock_t (long) value, which is the
> difference between the time field (for seconds) and millitm field (for
> milliseconds) in the structure that is returned from two calls to the
> ftime function. The first call to ftime is made within the start-up
> code of the executing program, and the second call is made when the
> clock function is explicitly called in your code.
> This means that the value returned by clock is the number of CLK_TCKs
> (milliseconds) elapsed since the start-up code was executed, or -1 if
> the function was unsuccessful.
> (end quote)

To be fair to Microsoft (yes, it sticks in my throat to say that), the clock() function has to be one of the worst named APIs around. Though some of the other time functions are up there as well. For example, back in mainframe days one OS (GEORGE III) used to name elapsed processor time the “mill time” (in a deliberate nod to Charles Babbage).