c语言gmtime_s在vs2022运行不了

为什么gmtime_s函数会运行不了

#include
#include

int main() {
char len[20] = { 0 };

time_t timep;
time(&timep);

struct tm* p = {0};
gmtime_s(p,&timep);

snprintf(len, 20, "%d-%d-%d %d:%d:%d", 1900 + p->tm_year, 1 + p->tm_mon, p->tm_mday, 8 + p->tm_hour, p->tm_min, p->tm_sec);

printf("\n%s\n", len);
return 0;

}

img

参数写反了吧
gmtime_s(&timep,p);


#include <stdio.h>
#include <time.h>
int main() {
    char len[20] = { 0 };

    time_t timep;
    time(&timep);    

    struct tm p ;    
    gmtime_s(&p, &timep);

    
    snprintf(len, 20, "%d-%d-%d %d:%d:%d", 1900 + p.tm_year, 1 + p.tm_mon, p.tm_mday, 8 + p.tm_hour, p.tm_min, p.tm_sec);
    printf("\n%s\n", len);

    return 0;
}