Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (7) </ [1] 2 3 4 5 6 ... >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Looking for World Time Application, Anybody know of a good one?< Next Oldest | Next Newest >
Juanito Offline





Group: Members
Posts: 1601
Joined: Sep. 2005
Posted: Sep. 23 2007,11:40 QUOTE

I'm looking for an application that displays the time in several locations - preferably analogue clocks that show the time in London, New York, Toyko, etc - that I can make into a mydsl extension.

So far, I've come across gworldtime but that requires gtk+2.0.

Does anybody know of a suitable application that uses gtk+1.2 or other base dsl libs? Could torsmo be used for this purpose?
Back to top
Profile PM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Sep. 23 2007,13:04 QUOTE

It could be made very easily with murgaLua.
I just woke up, so I'm in no condition to do it or show how to do it at the moment, but it probably shouldn't take more than a few minutes to put something like that together.

Of course it would depend on whether or not you want it to actively retreive the time from a server (probably need additional software?), or just set an offset for each clock using your system time.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
Juanito Offline





Group: Members
Posts: 1601
Joined: Sep. 2005
Posted: Sep. 23 2007,13:53 QUOTE

It'd take me more than a few minutes to put something together :)

There's already a timeserver script in dsl (somewhere), but in my case an offset from the local time would probably be best as my time zone (GMT+4) is not in the dsl subset of time zones.
Back to top
Profile PM 
WDef Offline





Group: Members
Posts: 798
Joined: Sep. 2005
Posted: Sep. 23 2007,14:44 QUOTE

More perl practice.  You could call something like this and display its output in torsmo:

Code Sample
#!/usr/bin/perl

# Useage : citytime.pl somecity

use strict;
use warnings;

my $URL = "http://www.timeanddate.com/worldclock/";

#================================

my $city = shift;
my $download = "/tmp/times.html";

if (!$city) {die "No city specified"};

print "Downloading time from $URL\n"; # legal

system("wget -O $download $URL &>/dev/null");

open(CONT, $download) or die("Could not open $download");

while (<CONT>){
if (/$city.+?(\d{1,2}\:\d+\d+ (AM|PM))/i) { print "$city $1\n"};
}


NB: there is a notice in the TimeAndDate html source saying that programs that download content "transparent to the user" are forbidden.  Hence the output informing of the download in the above.

But if there's any call for it, this could be adapted to pull time off some other page not having restrictions.

EDIT: added argument check.
Back to top
Profile PM 
Juanito Offline





Group: Members
Posts: 1601
Joined: Sep. 2005
Posted: Sep. 23 2007,15:04 QUOTE

Code Sample
$ /opt/citytime.pl tokyo
Downloading time from http://www.timeanddate.com/worldclock/
tokyo 12:30 AM


Impressive - and to have it in 24:00 format?
Back to top
Profile PM 
30 replies since Sep. 23 2007,11:40 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (7) </ [1] 2 3 4 5 6 ... >/
reply to topic new topic new poll
Quick Reply: Looking for World Time Application

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code