我是否需要从localtime()函数释放返回的指针?

Nid*_*ger 3 c free time pointers

我正在阅读有关的联机帮助页time.h.我到目前为止:

time_t now = time(0);
struct tm * local = localtime(&now);
Run Code Online (Sandbox Code Playgroud)

现在我可以和时间一起工作,但是我没有找到信息,如果它是我free()对变量的责任local.

Sou*_*osh 8

引用手册页

四大功能asctime(),ctime(),gmtime() localtime()返回一个指向静态数据,因此不是线程安全的.[...]

所以,你不需要free()返回的指针.