c - What are valid arguments for localtime function? -


i have code here uses localtime function. values of input argument, code crashes (null pointer returned). want know allowable range input.

#include <stdio.h> #include <time.h>  int main () {   time_t rawtime;   struct tm g;   struct tm *gp;   __int64 tim;    tim = 7476811632013133299ll; // know it's weird number valid time_t   rawtime = tim / 1000ll;   gp = localtime(&rawtime);   printf("pointer gp = %p\n", gp);    g = *gp; // crahses because gp = null    return 0; } 

so can said allowable range of input localtime function?

from msdn page localtime:

return pointer structure result, or null if date passed function is:

  • before midnight, january 1, 1970.

  • after 03:14:07, january 19, 2038, utc (using _time32 , time32_t).

  • after 23:59:59, december 31, 3000, utc (using _time64 , __time64_t).


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -