I have been trying to run a c function on my computer, which gives the number of seconds elapsed since Epoch, and it seems to work fine
#include <stdio.h>
#include <time.h>
int main () {
time_t seconds;
seconds = time(NULL);
printf("Number of seconds since January 1, 1970 = %ld\n", seconds);
return(0);
}
Now, I have a micro-controller on which I try to run the same code. It always gives me time since boot of the micro-controller, and not since EPOCH (January 1, 1970). So, I am bit confused why I dont get the usual result ? Do I need connection to internet so that some server sends out the timer since EPOCH to the time.h library ?
In other words if I run this code on a computer without internet connection, will I get the time since EPOCH. If not then why ?