Index: /ipk/source/tools_settime/CONTROL/control
===================================================================
--- /ipk/source/tools_settime/CONTROL/control	(revision 41100)
+++ /ipk/source/tools_settime/CONTROL/control	(revision 41100)
@@ -0,0 +1,6 @@
+Package: titan-plugin-tools-settime
+Version: 1.0
+Description: Set system time on the internet
+Section: tools
+Architecture: all
+Showname: Settime
Index: /ipk/source/tools_settime/CONTROL/postinst
===================================================================
--- /ipk/source/tools_settime/CONTROL/postinst	(revision 41100)
+++ /ipk/source/tools_settime/CONTROL/postinst	(revision 41100)
@@ -0,0 +1,26 @@
+#!/bin/sh
+INSTDIR="$1"
+
+sed s#_path_#"$INSTDIR"#g -i "$INSTDIR/mnt/bin/settime.sh"
+
+if [ "/mnt/swapextensions" == "$INSTDIR" ]; then
+	sed s#_type_#"MNT"#g -i "$INSTDIR/mnt/bin/settime.sh"
+elif [ "/var/swap" == "$INSTDIR" ]; then
+	sed s#_type_#"SWAP"#g -i "$INSTDIR/mnt/bin/settime.sh"
+else
+	sed s#_type_#"VAR"#g -i "$INSTDIR/mnt/bin/settime.sh"	
+fi
+
+
+if [ ! -e "$INSTDIR/mnt/config/usercmd.sh" ]; then
+	echo "use tpk config file: usercmd.sh"
+	echo "rename $INSTDIR/mnt/config/usercmd.sh.old > $INSTDIR/mnt/config/usercmd.sh"
+	mv "$INSTDIR/mnt/config/usercmd.sh.old" "$INSTDIR/mnt/config/usercmd.sh"
+else
+	echo "found user config file: usercmd.sh"
+	echo "skip tpk config file: usercmd.sh.old"
+fi
+
+
+
+exit 0
Index: /ipk/source/tools_settime/CONTROL/postrm
===================================================================
--- /ipk/source/tools_settime/CONTROL/postrm	(revision 41100)
+++ /ipk/source/tools_settime/CONTROL/postrm	(revision 41100)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exit 0
Index: /ipk/source/tools_settime/CONTROL/preinst
===================================================================
--- /ipk/source/tools_settime/CONTROL/preinst	(revision 41100)
+++ /ipk/source/tools_settime/CONTROL/preinst	(revision 41100)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exit 0
Index: /ipk/source/tools_settime/CONTROL/prerm
===================================================================
--- /ipk/source/tools_settime/CONTROL/prerm	(revision 41100)
+++ /ipk/source/tools_settime/CONTROL/prerm	(revision 41100)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exit 0
Index: /ipk/source/tools_settime/_path_/mnt/bin/settime.sh
===================================================================
--- /ipk/source/tools_settime/_path_/mnt/bin/settime.sh	(revision 41100)
+++ /ipk/source/tools_settime/_path_/mnt/bin/settime.sh	(revision 41100)
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+start_hms=03:00:00
+#logfile=/dev/null
+logfile=/mnt/logs/settime.log
+
+#
+# convert time from HH:MM:SS to seconds
+#
+
+hms2sec() {
+    hms_hh=`echo $1 | cut -f1 -d:`
+    hms_mm=`echo $1 | cut -f2 -d:`
+    hms_ss=`echo $1 | cut -f3 -d:`
+    hms2sec_sec=`expr \( $hms_hh \* 60 + $hms_mm \) \* 60 + $hms_ss`
+}
+
+#
+# main
+#
+
+    while [ 1 -eq 1 ] ; do
+        ntpdate -b ptbtime1.ptb.de >>$logfile
+        hms2sec `date "+%H:%M:%S"`
+        now_sec=$hms2sec_sec
+        hms2sec $start_hms
+        start_sec=$hms2sec_sec
+        sleep_sec=`expr 86400 + $start_sec - $now_sec`
+        echo `date "+%d %b %H:%M:%S"` `basename $0`[$$]: set time again in $sleep_sec seconds >>$logfile
+        sleep $sleep_sec
+    done
Index: /ipk/source/tools_settime/_path_/mnt/config/usercmd.sh
===================================================================
--- /ipk/source/tools_settime/_path_/mnt/config/usercmd.sh	(revision 41100)
+++ /ipk/source/tools_settime/_path_/mnt/config/usercmd.sh	(revision 41100)
@@ -0,0 +1,6 @@
+#!/bin/sh
+# start the user commands here
+echo "[usercmd.sh] start"
+/mnt/bin/settime.sh&
+
+exit
