It is hard to say exactly what is wrong from the code presented. However, in your comments, you related that remainder
has the type unsigned long long
. However, you pass its address to localtime()
, which is an error. localtime()
expects a time_t *
.
What might have happened is that due to the wrong type being passed in, localtime()
detected some error and returned a NULL
value. Then, passing this value into asctime()
resulted in a NULL
return value as well.
As an aside, your printf
has the wrong specifier. Use %llu
to print an unsigned long long
.