Kommentare zu: Countdown to Doomsday http://localhost/blah-dev/2012/06/16/countdown-to-doomsday/ Kurz und knapp und blah... Wed, 31 Jul 2013 20:21:22 +0000 hourly 1 http://wordpress.org/?v=3.6 Von: fritz the cat http://localhost/blah-dev/2012/06/16/countdown-to-doomsday/comment-page-1/#comment-17254 fritz the cat Thu, 21 Jun 2012 07:37:24 +0000 http://localhost/blah-dev/?p=12458#comment-17254 ich würde es hier hochladen :P

]]>
Von: Nachtwächter http://localhost/blah-dev/2012/06/16/countdown-to-doomsday/comment-page-1/#comment-17253 Nachtwächter Wed, 20 Jun 2012 21:34:11 +0000 http://localhost/blah-dev/?p=12458#comment-17253 Ich benutze ja beinahe nirgends Bildschrimschoner. Aber vielleicht… ;)

Wir werden alle sterben!

]]>
Von: penguinized http://localhost/blah-dev/2012/06/16/countdown-to-doomsday/comment-page-1/#comment-17252 penguinized Wed, 20 Jun 2012 20:50:21 +0000 http://localhost/blah-dev/?p=12458#comment-17252 Elias, noch Interesse? Dann lad ich Patch und Script hoch.

]]>
Von: penguinized http://localhost/blah-dev/2012/06/16/countdown-to-doomsday/comment-page-1/#comment-17224 penguinized Mon, 18 Jun 2012 20:02:43 +0000 http://localhost/blah-dev/?p=12458#comment-17224 Habs hingekriegt. in gltext die hart kodierte Variable für Update bei Programmen auf 1 Sekunde gesetzt und die while Schleife entfernt. Jetzt muß ich nur noch die Schrift ändern :)

]]>
Von: penguinized http://localhost/blah-dev/2012/06/16/countdown-to-doomsday/comment-page-1/#comment-17211 penguinized Sun, 17 Jun 2012 22:01:41 +0000 http://localhost/blah-dev/?p=12458#comment-17211 Ich bin dran, das mit xscreensaver nachzubauen. Script hätte ich (http://linuxconfig.org/time-countdown-bas h-script-example leicht abgewandelt).
Und dann sehe ich, daß gltext Programme nur alle 5s aktualisiert und ich bitte das als String in date- und strftime-kompatibler Form angeben soll….
WAS aber nicht so möglich ist, da der Text ja offensichtlich wirklich nur ein statischer Text ist (bis auf neuere Zeiten).

Das heißt: Wir müßten gltext umschreiben, daß jede Sekunde anstatt alle fünf Sekunden das Programm ausgeführt werde. Aber das SOLLTE ja machbar sein.

Das Bashskript für frei wählbare Weltuntergänge:
#!/bin/bash

if [ »$#« -lt »2″ ] ; then
echo »Incorrect usage ! Example:«
echo ›./countdown.sh -d »Jun 10 2011 16:06″›
echo ›or‹
echo ›./countdown.sh -m 90′
exit 1
fi

now=`date +%s`

if [ »$1″ = »-d« ] ; then
until=`date -d »$2″ +%s`
sec_rem=`expr $until – $now`
echo »-d«
if [ $sec_rem -lt 1 ]; then
echo »$2 is already history !«
fi
fi

if [ »$1″ = »-m« ] ; then
until=`expr 60 \* $2`
until=`expr $until + $now`
sec_rem=`expr $until – $now`
echo »-m«
if [ $sec_rem -lt 1 ]; then
echo »$2 is already history !«
fi
fi

while [ $sec_rem -gt 0 ]; do
clear
let sec_rem=$sec_rem-1
interval=$sec_rem
seconds=`expr $interval % 60`
interval=`expr $interval – $seconds`
minutes=`expr $interval % 3600 / 60`
interval=`expr $interval – $minutes`
hours=`expr $interval % 86400 / 3600`
interval=`expr $interval – $hours`
days=`expr $interval / 86400`

if [ »$hours« -lt »10″ ] ; then hours=`echo 0$hours`; fi
if [ »$minutes« -lt »10″ ] ; then minutes=`echo 0$minutes`; fi
if [ »$seconds« -lt »10″ ] ; then seconds=`echo 0$seconds`; fi
echo $days«:«$hours«:«$minutes«:«$seconds
sleep 1
done

]]>