The syntax for the gmtime function in the C Language is:
struct tm *gmtime(const time_t *timer);
usual call to gmtime would be
tm *xx = gmtime( &curr_time );
which would make it easier to check if NULL pointer was returned by gmtime function.
if (xx)
return sucess;
however it is not safe as The return value points to a statically allocated struct which might be overwritten by subsequent calls to any of the date and time functions.
so one of the safer approach would be to use
time_t curr_time = time(0);
tm xx = *gmtime( &curr_time );
but in case the if the call is made like this
how to check for null before dereferencing xx variable?
"not safe" source -- https://linux.die.net/man/3/gmtime