From: r_z_aret on
On Mon, 25 Jan 2010 16:06:03 +0100, "Larry" <dontmewithme(a)got.it>
wrote:

>Hi,
>
>is there any way to convert this to gmtime_s??
>
>// getDateTime (Fri, 10 Oct 2008 14:41:59 GMT)
>string getDateTime(void)
>{
> time_t rawtime;
> struct tm * timeinfo;
> time(&rawtime);
> timeinfo = gmtime(&rawtime);
> char buffer[30];
> strftime(buffer,30,"%a, %d %b %Y %X GMT",timeinfo);
> return static_cast<string>(buffer);
>}
>
>I cannot work out why VC++ is throwing so many warnings about that!

You may get more help if you give us at least a sample of the
warnings, and are more explicit about the meaning of "that".

You are returning a pointer to buffer, which goes out of scope when
the function returns. That could be a problem, but we can't see enough
code to be sure.

>
>thanks

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 400
Boston, MA 02116
www.penfact.com
Useful reading (be sure to read its disclaimer first):
http://catb.org/~esr/faqs/smart-questions.html