Do I need to delete the pointer returned by std::localtime?

Viewed 212

This is currently how I am getting system time:

void Sum_AnalogClock::GetSystemTime()
{
    std::time_t t = std::time(0);   // get time now
    std::tm* now = std::localtime(&t);
    angleSeconds =  now->tm_sec;
    angleMinutes = now->tm_min;
    angleHours = now->tm_hour;
    if (angleHours > 12)
        angleHours -= 12;
}

Do I need to delete now;?

2 Answers

No, according to the STD - std::localtime returns a "pointer to a static internal std::tm object on success".

So no need to delete anything.

Lior

Related