From 2643a5dc67dc6945ce8e0a3962818b16a240f0b5 Mon Sep 17 00:00:00 2001 From: Jonathan McCrohan Date: Wed, 19 Oct 2011 23:48:00 +0100 Subject: Add time code. --- append.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 append.c (limited to 'append.c') diff --git a/append.c b/append.c new file mode 100644 index 0000000..0b2bbbb --- /dev/null +++ b/append.c @@ -0,0 +1,20 @@ +#include +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) { + + time_t t = time(NULL); + struct tm tm = *localtime(&t); + FILE *fp; + fp=fopen("append.txt", "a+"); + + fprintf(fp,"%d-%d-%d %d:%d:%d\n", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); + fprintf(fp,"%d\n", ((int) t)/60*60); + fclose(fp); + + return 0; +} -- cgit v1.2.3