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

Re: [LI] World Clock



> Does it work. How?
>
> $ perl abc.pl (cut from the text below) gives error around line 11.
>
>
> At 04:47 AM 01/28/2000 +0530, you wrote:
> >
> >
> >> 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
# --- from here to
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");
#--- here it should be one line (line no 2)
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
it gave output
GMT Dublin               = Mon Jan 31 10:48:22 2000
London                   = Mon Jan 31 10:48:22 2000
Warsaw                   = Mon Jan 31 11:48:22 2000
........................removed some lines from here to save bandwidth
Moscow                   = Mon Jan 31 13:48:22 2000
Bangalore                = Mon Jan 31 16:18:22 2000
Trivandrum               = Mon Jan 31 16:18:22 2000
just now
----------------------------------------------------------------------------
--------
Jiju Thomas Mathew
Linux registered user #154193 -- http://counter.li.org



--------------------------------------------------------------------
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.