1
0
Fork 0

Add /date.

Signed-off-by: yc <yc@hackclub.app>
This commit is contained in:
YoungChief 2024-04-29 09:16:19 +00:00
parent 1ea5588e41
commit 54efca802d
Signed by: yc
SSH key fingerprint: SHA256:/762XoeFACwVxXLtK+gOlFF0brtEkdOeolz90+jCeRw

18
cgi/date.c Normal file
View file

@ -0,0 +1,18 @@
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main() {
time_t t = time(NULL);
if (t == -1) {
perror("time");
return 1;
}
struct tm *tm = localtime(&t);
if (tm == NULL) {
perror("localtime");
return 1;
}
printf("Content-Type: text/plain\n\n");
printf("%d-%02d-%02d", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
return 0;
}