[tz] Dealing with Pre-1970 Data

Zefram zefram at fysh.org
Sun Sep 1 10:35:33 UTC 2013


Lester Caine wrote:
>That is the simple bit, Longitude to an offset from UTC

Perl script attached for your convenience.

>However the one I was really thinking about was the 'equation of
>time' calculation in a format we can use as a 'standard'.

For what purpose do you expect to use *apparent* solar time?  If you
really want it, look at astronomical sources.  That's where the
demand exists for formulae for this and many other phenomena that are
tangentially related to time.

-zefram
-------------- next part --------------
#!/usr/bin/perl
{ use 5.010; }
use warnings;
use strict;
($ARGV[0] // "") =~ /\A
	(?:[-+](?:[0-9]{2}){1,3}(?:\.[0-9]+)?)?
	([-+])([0-9]{3})(?:([0-9]{2})(?:([0-9]{2}))?)?((?:\.[0-9]+)?)
\z/x or die "give me an ISO 6709 parameter";
my($sg, $ad, $am, $as, $frac) = ($1, $2, $3, $4, $5);
(defined($as) ? $as : defined($am) ? $am : $ad) .= $frac;
my $deg = ($ad + ($am // 0) / 60 + ($as // 0) / 3600);
my $sec = $deg * 240;
my $rsec = int($sec + 0.5);
printf "%s%02d:%02d:%02d\n", $sg, int($rsec/3600), int($rsec/60)%60, $rsec%60;
exit 0;


More information about the tz mailing list