How to generate a timestamp in C language?
To generate a timestamp in C language, you can use the time() function in the time.h header file. Here is the specific code:
#include <stdio.h>
#include <time.h>
int main() {
time_t timestamp;
timestamp = time(NULL);
printf("Timestamp: %ld\n", timestamp);
return 0;
}
In the code above, we are using the time() function to get the current timestamp, and then printing out this timestamp. The timestamp is the number of seconds that have passed since January 1, 1970 (also known as the UNIX epoch), representing the difference in time between the current time and January 1, 1970, 0:00:00 UTC.