summaryrefslogtreecommitdiff
path: root/ctime.c
diff options
context:
space:
mode:
Diffstat (limited to 'ctime.c')
-rw-r--r--ctime.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/ctime.c b/ctime.c
new file mode 100644
index 0000000..5ee8451
--- /dev/null
+++ b/ctime.c
@@ -0,0 +1,17 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+
+int main(int argc, char *argv[])
+{
+ time_t t;
+
+ if (argc>1)
+ t=(time_t)strtol(argv[1],NULL,0);
+ else
+ t=time(NULL);
+
+ printf("%s",ctime(&t));
+
+ return 0;
+}