A question about the asctime func...

From: Angus Mezick (angus@EDGIL.CCMAIL.COMPUSERVE.COM)
Date: 08/27/97


     ok... from act.wizard.c:
     ACMD(do_date)
     {
        char *tmstr;
        time_t mytime;
        int d, h, m;
        extern time_t boot_time;


        if (subcmd == SCMD_DATE)
           mytime = time(0);
        else
           mytime = boot_time;


        tmstr = (char *) asctime(localtime(&mytime));
        *(tmstr + strlen(tmstr) - 1) = '\0';


        if (subcmd == SCMD_DATE)
           sprintf(buf, "Current machine time: %s\r\n", tmstr);
        else
           {
           mytime = time(0) - boot_time;
           d = mytime / 86400;
           h = (mytime / 3600) % 24;
           m = (mytime / 60) % 60;


           sprintf(buf, "Up since %s: %d day%s, %d:%02d\r\n", tmstr, d,
            ((d == 1) ? "" : "s"), h, m);
           }


        send_to_char(buf, ch);
     }





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

     --Angus


     +------------------------------------------------------------+
     | 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