Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Matts (1087)

Matts
  (email not shown publicly)

I work for MessageLabs [messagelabs.com] in Toronto, ON, Canada. I write spam filters, MTA software, high performance network software, string matching algorithms, and other cool stuff mostly in Perl and C.

Journal of Matts (1087)

Tuesday January 11, 2005
09:25 AM

World clock

[ #22659 ]

There seem to be no *simple* and *free* world clocks for Mac OS X. The ones I've found are over 2MB downloads (some up to 6MB!!!). Jeez. All I want is a simple window at the bottom of my screen showing the time in the UK now.

Maybe time to dig up my Cocoa programming book.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I use GeekTool, which lets me run scripts and place the output on the desktop. I have the output of 'cal' in the upper left and the output of a simple Time::Human script in the bottom right. I turn off the menubar time.

    It would be easy to change the displayed timezone. (FWIW, I'm going to move to ProseClock instead of Time::Human, because Time::Human seems to have been abandoned until ActivePerl supports Module::Build. Long story. I should blog it.)
    --
    rjbs
    • Ah, that's fantastic. I'm now running:
      $ cat ~/London_Time.pl
      #!/usr/bin/perl -w
       
      my @parts = localtime(time + (3600 * 5));
       
      printf "London: %02d:%02d\n", $parts[2], $parts[1];
      Thanks for that!
        • Yeah I was aware of that. The alternative is to use something complex like DateTime.pm to get it right, but I don't need to get that complex really, and I don't want the overhead of loading DateTime.pm and all its friends for this little scriptlet (though I could use pperl to get around that).
          • The alternative is to use something complex like DateTime.pm

            ... or something simple like ...

            $ENV{TZ} = 'BST';

            my @parts = localtime(time + (3600 * 5));

            printf "London: %02d:%02d\n", $parts[2], $parts[1];
          • Sorry, engage brain before cutting and pasting. This is what I meant:

            $ENV{TZ} = 'BST';

            my @parts = localtime;

            printf "London: %02d:%02d\n", $parts[2], $parts[1];

            or

            use POSIX;

            $ENV{TZ} = "BST";

            print strftime "London: %H:%M\n", localtime;