ctdlsh now has two working commands, 'date' and 'passwd'
[citadel.git] / ctdlsh / src / datetime.c
index a93e50ea7042619e3e6fb80e9907bc38cf04d3d3..122b98f7fd0c45a6edc8d5021a72b0d835ce067a 100644 (file)
@@ -5,8 +5,15 @@
 
 #include "ctdlsh.h"
 
-int cmd_datetime(char *cmdbuf) {
-       abort();
+int cmd_datetime(int server_socket, char *cmdbuf) {
+       char buf[1024];
+       time_t now;
+
+       sock_puts(server_socket, "TIME");
+       sock_getln(server_socket, buf, sizeof buf);
+       now = atol(&buf[4]);
+       printf("%s", asctime(localtime(&now)));
+       return(cmdret_ok);
 }