Re: A question about the asctime func...

From: d. hall (dhall@APK.NET)
Date: 08/28/97


I'm getting pretty ticked about this, which damn line is offending the
listserv software?

------------------------ Rejected message (36 lines) --------------------------
To: circle@post.queensu.ca
Subject: Re:  A question about the asctime func...
From: dhall@apk.net (d. hall)

// thus on Wed, 27 Aug 1997 13:45:42 EDT, Angus virtually wrote:

Angus> my question is, does the memory pointed to by tmstr go away at the
Angus> end of the function?  is this the same as going: tmstr="present
Angus> time"; ?

According to most systems, the asctime() function returns a pointer to
statically allocated string, "which might be overwritten by subsequent
calls to any of the date and time functions".

This is how GNU's libc is, and how it is in Solaris.

If you want a thread-safe version, on Solaris is has a list of time_r
functions, asctime_r is "thread-safe" in that you supply your own buffer to
write the information to.

d.


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST