From 117261264de540759d0083402b8e476dae2a2b98 Mon Sep 17 00:00:00 2001 From: reinelt <> Date: Thu, 20 May 2004 07:47:51 +0000 Subject: [lcd4linux @ 2004-05-20 07:47:51 by reinelt] added plugin_time --- Makefile.am | 3 ++- Makefile.in | 14 +++++------ plugin.c | 20 ++++++++++----- plugin_time.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 102 insertions(+), 14 deletions(-) create mode 100644 plugin_time.c diff --git a/Makefile.am b/Makefile.am index 0f26e5a..84710b7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -37,9 +37,10 @@ widget_bar.c widget_bar.h \ widget_icon.c widget_icon.h \ \ plugin.c plugin.h \ +plugin_cfg.c \ plugin_math.c \ plugin_string.c \ -plugin_cfg.c +plugin_time.c #liblcd4linux_la_DEPENDENCIES = @DRIVERS@ #liblcd4linux_la_LDFLAGS = -version-info 9:12:9 diff --git a/Makefile.in b/Makefile.in index d9de5e3..f95b582 100644 --- a/Makefile.in +++ b/Makefile.in @@ -92,7 +92,7 @@ lcd4linux_LDADD = @DRIVERS@ @PLUGINS@ @DRVLIBS@ @PLUGINLIBS@ #remove next line for liblcd4linux lcd4linux_DEPENDENCIES = @DRIVERS@ @PLUGINS@ -lcd4linux_SOURCES = lcd4linux.c cfg.c cfg.h debug.c debug.h drv.c drv.h evaluator.c evaluator.h hash.c hash.h layout.c layout.h lock.c lock.h pid.c pid.h timer.c timer.h thread.c thread.h udelay.c udelay.h qprintf.c qprintf.h widget.c widget.h widget_text.c widget_text.h widget_bar.c widget_bar.h widget_icon.c widget_icon.h plugin.c plugin.h plugin_math.c plugin_string.c plugin_cfg.c +lcd4linux_SOURCES = lcd4linux.c cfg.c cfg.h debug.c debug.h drv.c drv.h evaluator.c evaluator.h hash.c hash.h layout.c layout.h lock.c lock.h pid.c pid.h timer.c timer.h thread.c thread.h udelay.c udelay.h qprintf.c qprintf.h widget.c widget.h widget_text.c widget_text.h widget_bar.c widget_bar.h widget_icon.c widget_icon.h plugin.c plugin.h plugin_cfg.c plugin_math.c plugin_string.c plugin_time.c #liblcd4linux_la_DEPENDENCIES = @DRIVERS@ @@ -123,8 +123,8 @@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ lcd4linux_OBJECTS = lcd4linux.o cfg.o debug.o drv.o evaluator.o hash.o \ layout.o lock.o pid.o timer.o thread.o udelay.o qprintf.o widget.o \ -widget_text.o widget_bar.o widget_icon.o plugin.o plugin_math.o \ -plugin_string.o plugin_cfg.o +widget_text.o widget_bar.o widget_icon.o plugin.o plugin_cfg.o \ +plugin_math.o plugin_string.o plugin_time.o CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -153,10 +153,10 @@ DEP_FILES = .deps/BeckmannEgle.P .deps/MilfordInstruments.P \ .deps/plugin_loadavg.P .deps/plugin_math.P .deps/plugin_meminfo.P \ .deps/plugin_mysql.P .deps/plugin_netdev.P .deps/plugin_pop3.P \ .deps/plugin_ppp.P .deps/plugin_proc_stat.P .deps/plugin_seti.P \ -.deps/plugin_string.P .deps/plugin_uname.P .deps/plugin_wireless.P \ -.deps/plugin_xmms.P .deps/qprintf.P .deps/thread.P .deps/timer.P \ -.deps/udelay.P .deps/widget.P .deps/widget_bar.P .deps/widget_icon.P \ -.deps/widget_text.P +.deps/plugin_string.P .deps/plugin_time.P .deps/plugin_uname.P \ +.deps/plugin_wireless.P .deps/plugin_xmms.P .deps/qprintf.P \ +.deps/thread.P .deps/timer.P .deps/udelay.P .deps/widget.P \ +.deps/widget_bar.P .deps/widget_icon.P .deps/widget_text.P SOURCES = $(lcd4linux_SOURCES) $(EXTRA_lcd4linux_SOURCES) OBJECTS = $(lcd4linux_OBJECTS) diff --git a/plugin.c b/plugin.c index 4a0e92c..5e2a58e 100644 --- a/plugin.c +++ b/plugin.c @@ -1,4 +1,4 @@ -/* $Id: plugin.c,v 1.28 2004/04/12 11:12:26 reinelt Exp $ +/* $Id: plugin.c,v 1.29 2004/05/20 07:47:51 reinelt Exp $ * * plugin handler for the Evaluator * @@ -22,6 +22,9 @@ * * * $Log: plugin.c,v $ + * Revision 1.29 2004/05/20 07:47:51 reinelt + * added plugin_time + * * Revision 1.28 2004/04/12 11:12:26 reinelt * added plugin_isdn, removed old ISDN client * fixed some real bad bugs in the evaluator @@ -165,12 +168,14 @@ // Prototypes +int plugin_init_cfg (void); +void plugin_exit_cfg (void); int plugin_init_math (void); void plugin_exit_math (void); int plugin_init_string (void); void plugin_exit_string (void); -int plugin_init_cfg (void); -void plugin_exit_cfg (void); +int plugin_init_time (void); +void plugin_exit_time (void); int plugin_init_apm (void); void plugin_exit_apm (void); @@ -212,9 +217,10 @@ void plugin_exit_xmms (void); int plugin_init (void) { + plugin_init_cfg(); plugin_init_math(); plugin_init_string(); - plugin_init_cfg(); + plugin_init_time(); #ifdef PLUGIN_APM plugin_init_apm(); @@ -270,9 +276,11 @@ int plugin_init (void) #ifdef PLUGIN_XMMS plugin_init_xmms(); #endif + return 0; } + void plugin_exit(void) { #ifdef PLUGIN_APM plugin_exit_apm(); @@ -330,9 +338,9 @@ void plugin_exit(void) { #endif plugin_exit_cfg(); - plugin_exit_string(); plugin_exit_math(); - + plugin_exit_string(); + plugin_exit_time(); DeleteFunctions(); DeleteVariables(); diff --git a/plugin_time.c b/plugin_time.c new file mode 100644 index 0000000..4cd0338 --- /dev/null +++ b/plugin_time.c @@ -0,0 +1,79 @@ +/* $Id: plugin_time.c,v 1.1 2004/05/20 07:47:51 reinelt Exp $ + * + * time plugin + * + * Copyright 2003,2004 Michael Reinelt + * Copyright 2004 The LCD4Linux Team + * + * This file is part of LCD4Linux. + * + * LCD4Linux is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * LCD4Linux is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + * $Log: plugin_time.c,v $ + * Revision 1.1 2004/05/20 07:47:51 reinelt + * added plugin_time + * + */ + +/* + * exported functions: + * + * int plugin_init_time (void) + * adds some handy time functions + * + */ + + +#include "config.h" + +#include + +#include "debug.h" +#include "plugin.h" + + +static void my_time (RESULT *result) +{ + double value = time(NULL); + SetResult(&result, R_NUMBER, &value); +} + + +static void my_strftime (RESULT *result, RESULT *arg1, RESULT *arg2) +{ + char value[256]; + time_t t = R2N(arg2); + + value[0] = '\0'; + strftime(value, sizeof(value), R2S(arg1), localtime(&t)); + + SetResult(&result, R_STRING, value); +} + + +int plugin_init_time (void) +{ + + // register some basic time functions + AddFunction ("time", 0, my_time); + AddFunction ("strftime", 2, my_strftime); + + return 0; +} + +void plugin_exit_time(void) +{ +} -- cgit v1.2.3 22/+4879 2016-06-11Release 0+git20160503.4f192bd-1debian/0+git20160503.4f192bd-1Jonathan McCrohan1-2/+2 2016-06-11d/control: update insecure Vcs-Git URLJonathan McCrohan2-1/+2 2016-06-11d/control: update Standards Version to 3.9.8Jonathan McCrohan2-1/+9 2016-06-11Imported Upstream version 0+git20160503.4f192bdupstream/0+git20160503.4f192bdJonathan McCrohan1307-2667/+38002 2016-01-18Release 0+git20151202.3864e0a-1debian/0+git20151202.3864e0a-1Jonathan McCrohan1-2/+3 2016-01-18Imported Upstream version 0+git20151202.3864e0aJonathan McCrohan840-4057/+18230 2016-01-18Update get-vcs-snapshot.sh to reflect gbp changesJonathan McCrohan2-1/+2 2016-01-18Imported Upstream version 0+git20151202.3864e0aupstream/0+git20151202.3864e0aJonathan McCrohan840-4057/+18230 2015-05-05d/control: various fixes found by libconfig-model-dpkg-perlJonathan McCrohan2-5/+13 2015-04-01Release 0+git20150208.f2053b3-1Jonathan McCrohan1-2/+2 2015-04-01Describe changes made in snapshotJonathan McCrohan1-0/+3 2015-04-01New Upstream Snapshot (commit f2053b3)Jonathan McCrohan1-0/+6 2015-04-01Imported Upstream version 0+git20150208.f2053b3upstream/0+git20150208.f2053b3Jonathan McCrohan32-333/+483 2014-12-28Release 0+git20141218.b46a22c-1debian/0+git20141218.b46a22c-1Jonathan McCrohan1-2/+2 2014-12-28Updated AU DVB-T files; Thanks Brian Burch! (Closes LP: #1393280)Jonathan McCrohan1-0/+1 2014-12-28New Upstream Snapshot (commit b46a22c)Jonathan McCrohan1-0/+6 2014-12-28Imported Upstream version 0+git20141218.b46a22cupstream/0+git20141218.b46a22cJonathan McCrohan535-639/+317 2014-10-20Release 0+git20141009.d26b627-1debian/0+git20141009.d26b627-1Jonathan McCrohan1-2/+2 2014-10-20Fix up packaging to account for move to DVBv5Jonathan McCrohan2-2/+6 2014-10-20delete d/dtv-scan-files.install; Upstream now supplies a MakefileJonathan McCrohan2-4/+1 2014-10-15d/control: update Standards Version to 3.9.6Jonathan McCrohan2-1/+3 2014-10-15d/control: add Build-Depends on dvb-toolsJonathan McCrohan2-1/+2 2014-10-15New Upstream Snapshot (commit d26b627)Jonathan McCrohan1-0/+10 2014-10-15Imported Upstream version 0+git20141009.d26b627upstream/0+git20141009.d26b627Jonathan McCrohan2010-11120/+159271 2014-07-23Release 0+git20140611.14bd6c7-1debian/0+git20140611.14bd6c7-1Jonathan McCrohan1-2/+2 2014-07-23New Upstream Snapshot (commit 14bd6c7)Jonathan McCrohan1-2/+3 2014-07-23Imported Upstream version 0+git20140611.14bd6c7upstream/0+git20140611.14bd6c7Jonathan McCrohan7-11/+60 2014-05-13New Upstream Snapshot (commit 1246b27)Jonathan McCrohan1-0/+6 2014-05-13Imported Upstream version 0+git20140512.1246b27upstream/0+git20140512.1246b27Jonathan McCrohan391-301/+3983 2014-04-05Release 0+git20140326.cfc2975-1debian/0+git20140326.cfc2975-1Jonathan McCrohan1-2/+2 2014-04-05d/control: update Homepage (upstream has moved from Gitweb to cgit)Jonathan McCrohan2-1/+2 2014-04-05New Upstream Snapshot (commit cfc2975)Jonathan McCrohan1-0/+6 2014-04-05Imported Upstream version 0+git20140326.cfc2975upstream/0+git20140326.cfc2975Jonathan McCrohan118-656/+877 2014-01-16Release 0+git20140107.1850cf8-1debian/0+git20140107.1850cf8-1Jonathan McCrohan1-2/+2 2014-01-16Update Standards Version to 3.9.5Jonathan McCrohan2-1/+9