[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: [LI] World Clock




> Has anyone come across a decent world clock program for Linux?
I got my solution (no frills but maybe it would help)
#---------cut here
#!/usr/bin/perl
my @zonedif=("GMT Dublin=0", "London=0", "Warsaw=+01:00", "Paris=+01:00",
"Berlin=+01:00", "Rome=+01:00", "Amsterdam=+01:00", "Eastern Europe=+02:00",
"Prague=+01:00", "Athens=+02:00", "Helsinki=+02:00", "Istanbul=+02:00",
"Brasilia=-03:00", "Atlantic Time=-04:00", "Alaska=-09:00", "Hawaii=-10:00",
"Midway Island=-11:00", "Wellington=+12:00", "Sydney=+10:00",
"Adelaide=+09:30", "Tokyo=+09:00", "Seoul=+09:00", "Hong Kong=+08:00",
"Singapore=+08:00", "Bangkok=+07:00", "India (IST)=+05:30",
"Colombo=+05:30", "Abu Dhabi=+04:00", "Muscat=+04:00", "Tehran=+03:30",
"Kuwait=+03:00", "Riyadh=+03:00", "Kabul=+04:30", "Cairo=+02:00",
"Moscow=+03:00", "Bangalore=+05:30", "Trivandrum=+05:30");

foreach (@zonedif){
 ($zonename,$diff)=split /=/,$_;
 ($hr,$mi)=split /:/,$diff;
 $hr1=$hr*3600;
 $mi1=$mi*60;
 $diff=$hr1+$mi1;
 $gmt_now=time;
 $zonetime=gmtime($gmt_now+($diff));
 printf "%-25s= %-s\n",$zonename,$zonetime;
}
#---------cut here



--------------------------------------------------------------------
The Linux India Mailing List Archives are now available.  Please search
the archive at http://lists.linux-india.org/ before posting your question
to avoid repetition and save bandwidth.