How to add time stamps for two time zones in the body of e-mails

Pongo A. Pan pongo_pan at charter.net
Sat Dec 18 17:15:58 UTC 2010


On Sat, 2010-12-18 at 14:47 +0000, user1 wrote:
> How can I add time stamps for two time zones, my local time zone and 
> another time zone, e.g. for Sweden and Knoxville.
> 
> I would like my e-mail to begin with something like:
> 
> This e-mail is sent at:
> Thu Dec 16 2010 14:25:02 Swedish time
> Thu Dec 16 2010 08:25:02 Knoxville time
> 
> In this way ordinary recepients can immediately see when the email was 
> written?
> 
> I am using the Evolution e-mail client program.
> 
> 
You could use a script for your signature and do it there (easy with
evolution).  

I haven't bothered with this much, but my DW, the perl girl, likes to
play with it.  She's now horrified that I'm posting her "crude code"
with my even cruder mods, but here it is:

  #!/usr/bin/perl -w


  chomp(my $lrelease = `cat /etc/issue`);           # get distro version
  my $iz = index($lrelease, "\\");		  # pretty it up
  my $release = substr($lrelease, 0, ($iz-1));
  chomp(my $uptime = `uptime`);			  # computer uptime


  chomp(my $uname = `uname -sr`); 	  # get kernel    version
  chomp(my $host = `hostname`);			  # computer name
  chomp(my $gnome = `gnome-about --gnome-version`); # always use gnome

  my $ix = index($uptime, 'up');		  # some string slicing
  $uptime = substr($uptime, $ix -1);

  my $iy = index($gnome, 'D');		
  my $sgnome = substr($gnome, 0, ($iy-1));
  $iy = index($sgnome, ':');
  my $vgnome = substr($sgnome, ($iy+1));

  chomp (my $date = `date`);			  # time here
  chomp (my $sweden = `zdump Europe/Stockholm`);    # time there
  open (SIG, '<', '/home/pongo/.evolution/signatures/signature-4') or
die $!; 
	# signature-4 was made in evolution already 

  while (<SIG>) {                                   # print the evo sig
    chomp();
    print ($_, "<br>\n");
  }

  print ("Local time: ",$date," <br>\n");         # now add our stuff
  print ($sweden,"<br>\n");
  print (ucfirst ($host));
  print ($uptime, "<br>\n" );
  print $uname, " ";
  print ($release, ", Gnome", $vgnome. "<br>\n");

  close (SIG);					  # clean up!


You could probably do this with a bash script or python or whatever, but
when all you have is a hammer ...

HTH, and that I get out of the dog house.


 
-- 
Pongo
p. pygmaeus - now in the hominidae!
Local time: Sat Dec 18 09:12:13 PST 2010 
Europe/Stockholm Sat Dec 18 18:12:13 2010 CET
Aurelius up 1 day, 18:55, 2 users, load average: 0.27, 0.21, 0.18
Linux 2.6.35-22-generic Linux Mint 10 Julia, Gnome 2.32.0






More information about the ubuntu-users mailing list