NAME
Time::UTC_SLS  UTC with Smoothed Leap Seconds
SYNOPSIS
use Time::UTC_SLS qw(utc_to_utcsls utcsls_to_utc);
$mjd = utc_to_utcsls($day, $secs);
($day, $secs) = utcsls_to_day($mjd);
use Time::UTC_SLS qw(
utc_day_to_mjdn utc_mjdn_to_day
utc_day_to_cjdn utc_cjdn_to_day);
$mjdn = utc_day_to_mjdn($day);
$day = utc_mjdn_to_day($mjdn);
$cjdn = utc_day_to_cjdn($day);
$day = utc_cjdn_to_day($cjdn);
DESCRIPTION
Coordinated Universal Time (UTC) is a time scale with days of unequal lengths, due to leap seconds, in order to keep in step with both Terran rotation (Universal Time, UT) and International Atomic Time (TAI). Some applications that wish to use a time scale that maintains both of these relations can't cope with unequal day lengths, and so cannot use UTC properly. UTC with Smoothed Leap Seconds (UTCSLS) is another option in such cases. UTCSLS is a time scale that usually matches UTC exactly but changes rate in the time leading up to a leap second in order to make every day appear to be exactly the same length.
On a normal UTC day, of length 86400 UTC seconds, UTC and UTCSLS behave identically. On a day with a leap second, thus having 86401 or (theoretically) 86399 UTC seconds, UTC and UTCSLS behave identically for most of the day, but the last 1000 UTC seconds correspond to 999 or (theoretically) 1001 UTCSLS seconds. Thus every UTCSLS day has exactly 86400 UTCSLS seconds. UTC and UTCSLS are equal on every half hour, and in particular the day boundaries (at midnight) are in the same place on both time scales. See http://www.cl.cam.ac.uk/~mgk25/time/utcsls/ for further explanation.
UTCSLS is defined for the post1972 form of UTC, using leap seconds. The prior form, from 1961, using `rubber seconds' as well as leaps, could be treated in a similar manner, but the exact algorithm has not been defined. The rubber seconds system was itself trying to achieve part of what UTCSLS does.
This module represents instants on the UTC scale by the combination of a day number and a number of seconds since midnight within the day. In this module the day number is the integral number of days since 19580101, which is the epoch of TAI. This is the convention used by the Time::UTC
module. Instants on the UTCSLS scale are represented by a Modified Julian Date, which is a fractional count of days since 18581117T00Z. The MJD is a suitable interchange format between datemanipulation modules.
All numbers in this API are Math::BigRat
objects. All numeric function arguments must be Math::BigRat
s, and all numeric values returned are likewise Math::BigRat
s.
FUNCTIONS
 utc_to_utcsls(DAY, SECS)

Converts from UTC to UTCSLS. The input is a UTC instant expressed as a day number and a number of seconds since midnight, both as
Math::BigRat
objects. Returns the corresponding UTCSLS instant expressed as a Modified Julian Date, as aMath::BigRat
object.  utcsls_to_utc(MJD)

Converts from UTCSLS to UTC. The input is a UTCSLS instant expressed as a Modified Julian Date, as a
Math::BigRat
object. Returns a list of two values, giving the corresponding UTC instant expressed as a day number and a number of seconds since midnight, both asMath::BigRat
objects.  utc_day_to_mjdn(DAY)

Takes a day number (days since the TAI epoch), as a
Math::BigRat
object, and returns the corresponding Modified Julian Day Number (a number of days since 18581117 UT), as aMath::BigRat
object. MJDN is a standard numbering for days in Universal Time. There is no bound on the permissible day numbers; the function is not limited to days for which UTCSLS is defined.  utc_mjdn_to_day(MJDN)

This performs the reverse of the translation that
utc_day_to_mjdn
does. It takes a Modified Julian Day Number, as aMath::BigRat
object, and returns the number of days since the TAI epoch, as aMath::BigRat
object. It does not impose any limit on the range.  utc_day_to_cjdn(DAY)

Takes a day number (days since the TAI epoch), as a
Math::BigRat
object, and returns the corresponding Chronological Julian Day Number (a number of days since 47131124), as aMath::BigRat
object. CJDN is a standard day numbering that is useful as an interchange format between implementations of different calendars. There is no bound on the permissible day numbers; the function is not limited to days for which UTCSLS is defined.  utc_cjdn_to_day(CJDN)

This performs the reverse of the translation that
utc_day_to_cjdn
does. It takes a Chronological Julian Day Number, as aMath::BigRat
object, and returns the number of days since the TAI epoch, as aMath::BigRat
object. It does not impose any limit on the range.
SEE ALSO
Date::JD, Time::UTC, http://www.cl.cam.ac.uk/~mgk25/time/utcsls/
AUTHOR
Andrew Main (Zefram) <zefram@fysh.org>
COPYRIGHT
Copyright (C) 2006, 2007, 2009, 2010, 2012, 2017 Andrew Main (Zefram) <zefram@fysh.org>
LICENSE
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.