✨ Add UNIX timestamp CGI script.
Signed-off-by: yc <yc@hackclub.app>
This commit is contained in:
parent
e8932313cd
commit
159ffc2e95
1 changed files with 13 additions and 0 deletions
13
cgi/time.c
Normal file
13
cgi/time.c
Normal file
|
@ -0,0 +1,13 @@
|
|||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
int main() {
|
||||
time_t current_time;
|
||||
current_time = time(NULL);
|
||||
printf("Content-type:text/plain\n\n");
|
||||
if (current_time == ((time_t)-1)) {
|
||||
printf("Unable to get current time.\n");
|
||||
return 1;
|
||||
}
|
||||
printf("%ld", (long)current_time);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue