[PATCH_v2] use CLOCK_MONOTONIC_COARSE posix timer instead of CLOCK_MONOTONIC in Xorg

Jeremy Huddleston jeremyhu at apple.com
Fri Aug 27 10:02:29 PDT 2010


On Aug 27, 2010, at 01:04, Michel Dänzer wrote:

> On Don, 2010-08-26 at 20:36 -0700, Jeremy Huddleston wrote: 
>> On Aug 26, 2010, at 18:20, yakui.zhao at intel.com wrote:
>>> #ifdef MONOTONIC_CLOCK
>>>    struct timespec tp;
>>> -    if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
>>> +    static clockid_t clockid;
>> 
>> static clockid_t clockid = 0;
> 
> static variables are implicitly initialized to 0.

I thought that was from C99 (but most systems, and all modern secure ones, ensured the memory was initialized to 0 anyway).

But indeed from K&R (via http://www.iu.hio.no/~mark/CTutorial/CTutorial.html), "Static variables are always guaranteed to be initialized to zero anyway, whereas auto or local variables are guaranteed to be garbage: this is because static storage is created by the compiler in the body of a program, whereas auto or local storage is created at run time."



More information about the xorg-devel mailing list