Re: Clib time functions
- From: Rob Kendrick <nntp@xxxxxxxx>
- Date: Fri, 25 Jan 2008 14:11:24 GMT
On Fri, 25 Jan 2008 14:44:51 +0100, Erik G wrote:
Here is what Harbison & Steele[1] say about this:
"In most implementations gmtime() and localtime() retrun a pointer to a
single static data area that is overwritten on every call. Therefore,
the returned structure should be used or copied before any subsequent
call to either function."
Their warning is not quite strong enough - from the C99 spec:
Except for the strftime function, these functions each return a pointer
to one of two types of static objects: a broken-down time structure or
an array of char. Execution of any of the functions that return a
pointer to one of these object types may overwrite the information in
any object of the same type pointed to by the value returned from any
previous call to any of them. The implementation shall behave as if no
other library functions call these functions.
The upshot is similar, but it's likely that any local or custom
extensions would follow this convention.
B.
.
- References:
- Clib time functions
- From: Alan Wrigley
- Re: Clib time functions
- From: Erik G
- Clib time functions
- Prev by Date: Re: Sprites, Sprites22, Sprites11, Sprites72, Sprites3.14
- Next by Date: Re: Clib time functions
- Previous by thread: Re: Clib time functions
- Index(es):
Relevant Pages
|
Loading