[Toxine-cvs] CVS: toxine/src commands.c,1.67,1.68
Brought to you by:
f1rmb
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-19 20:19:13
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25466 Modified Files: commands.c Log Message: add gettime command Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- commands.c 17 May 2004 21:23:35 -0000 1.67 +++ commands.c 19 May 2004 20:19:03 -0000 1.68 @@ -30,6 +30,7 @@ #include <errno.h> #include <time.h> #include <pthread.h> +#include <time.h> #include <readline.h> #include <tilde.h> @@ -160,7 +161,7 @@ static void do_echo(commands_t *, toxine_t *, void *); static void do_dumpconfig(commands_t *, toxine_t *, void *); static void do_dumpstream(commands_t *, toxine_t *, void *); - +static void do_gettime(commands_t *, toxine_t *, void *); static commands_t commands[] = { { "!", NO_ARGS, do_shell, @@ -242,6 +243,10 @@ "get video property_min_max <property> (see xine_get_video_property_min_max)\n" "get video help" }, + { "gettime", NO_ARGS, do_gettime, + "Display current time.", + "gettime" + }, { "help", OPTIONAL_ARGS, do_help, "Display the help text if a command name is specified, otherwise display all available commands.", "help [command]" @@ -2345,3 +2350,14 @@ static void do_dumpstream(commands_t *command, toxine_t *tox, void *data) { _NAPI_xine_dumpstream(tox); } + +static void do_gettime(commands_t *command, toxine_t *tox, void *data) { + struct tm *ptm; + struct timeval tv; + + gettimeofday(&tv, NULL); + if((ptm = localtime(&tv.tv_sec))) + pinfo("%02d:%02d:%02d.%d\n", ptm->tm_hour, ptm->tm_min, ptm->tm_sec, (int)(tv.tv_usec / 1000)); + + pinfo(".\n"); +} |