std/time/ut1▲toc

The UT1 (and UT2) time scale and calendar.

The UT1 time scale is based on the rotation of the earth where one rotation is 86400 seconds. The exact UT1 time can only be determined by measuring the Earth's rotation angle very precisely. The International Earth Rotation Service (IERS) issues bulletin A containing accurate (UT1 - UTC) deltas.

The library provides the cal-ut1-load function to automatically cache and download the latest USNO bulletin A information (finals2000A all and daily) to calculate UT1 very accurately from 1972 until about 3 months from now (using predicted values). By default it downloads daily data every week and full data about every 8 weeks. For dates outside this range, the library uses its builtin tables and approximations:

You can also use cal-ut1-approx to not download any recent data and always use approximated values.

Usage:

val cal-ut1 = cal-ut1-load()
val i = now()
i.time().show.println              // in UTC
i.time(cal=cal-ut1).show.println   // in UT1
val cal-ut1 = cal-ut1-load()
val i = now()
i.time().show.println              // in UTC
i.time(cal=cal-ut1).show.println   // in UT1
.

Calculate ΔT (= TT - UT1); If the dt-override function returns Nothingstd/core/Nothing: forall<a> maybe<a>, it tries in order:

  • monthly determined tables for any observed date (usually > 1973 up to now (2016))
  • quarterly prediction tables for dates > now (2016) up to about 10 years (2025)
  • yearly historic tables for dates >= 1750
  • fitted parabolic approximations for dates between -500 and 2150; (Espenak & Meeus 2006)
  • generic parabolic approximation for dates < -500 and dates > 2150 (Morrison and Stephenson, 2004.).
Load IERS bulletin A information for precise UT1 determination. Loads and caches both the daily and all data. Downloads a fresh daily file about every week (download-delay) with a given download-timeout (=5s). The full data is refreshed only every 8*download-delay (=8.weeksstd/time/duration/weeks: (n : int) -> duration). The basenamestd/os/path/basename: (p : path) -> string gives the basic file name finals2000A and the baseurl the download URL (= http://​maia.​usno.​navy.​mil/​ser7/​). Set the baseurl to the empty string to suppress automatic downloading. The files are cached in the config/ directory of the application installation directory. Set the optional parameter verbose to Falsestd/core/False: bool to suppress trace messages on downloads or errors.

Load IERS bulletin A information for precise UT1 determination. Loads the full bulletin A data since 1973 with about 1 year of predictions. Uses linear interpolation between daily UT1-UTC values. By default loads the file fname (= "config/finals2000A.all" in the application directory). If the file is not present, it will be downloaded from url. The default url is:
http://​maia.​usno.​navy.​mil/​ser7/​finals2000A.​all
Set the url to the empty string to suppress automatic downloading. If the file is older than download-delay (=4.weeksstd/time/duration/weeks: (n : int) -> duration) the file is automatically refreshed from url. The download-timeout (=20.seconds) gives the maximum time for downloading to finish (the full data is about 3mb in size). Set the optional parameter verbose to Falsestd/core/False: bool to suppress trace messages on downloads or errors.

Load the daily IERS bulletin A information for precise UT1 determination. The daily file contains information for the past 90 days with 90 days of predictions. This file is about 40kb and much smaller than the full data. Uses linear interpolation between daily UT1-UTC values. By default loads the file fname (= "config/finals2000A.daily" in the application directory). If the file is not present, it will be downloaded from url. The default url is:
http://​maia.​usno.​navy.​mil/​ser7/​finals2000A.​daily
Set the url to the empty string to suppress automatic downloading. If the file is older than download-delay (=1.weeksstd/time/duration/weeks: (n : int) -> duration) the file is automatically refreshed from url. The download-timeout (=5.seconds) gives the maximum time for downloading to finish. Set the optional parameter verbose to Falsestd/core/False: bool to suppress trace messages on downloads or errors.

The default UT1 (Universal time 1) timescale Uses builtin approximation of UT1 time as described in deltatstd/time/ut1/deltat: (i : instant, dt-override : ?(i : instant) -> maybe<duration>) -> duration. To calculate UT1 more precisely, use cal-ut1-load (or cal-ut1-create).

Takes an optional dt parameter to calculate ΔT (=TT - UT1) more precisely. The dt functions should return Nothingstd/core/Nothing: forall<a> maybe<a> for instants outside its range so the builtin methods can be used in that case (see deltatstd/time/ut1/deltat: (i : instant, dt-override : ?(i : instant) -> maybe<duration>) -> duration).

Create a new UT1 calendar using IERS bulletin A data for precise UT1 calculation. Uses linear interpolation between daily UT1-UTC values. This is a convenience function that composes load-iers-ut1 and cal-ut1-create.
By default loads the daily and full data from the files basenamestd/os/path/basename: (p : path) -> string (= "config/finals2000A" in the application directory). If the files are not present, they will be downloaded from url. The default url is:
http://​maia.​usno.​navy.​mil/​ser7
Set the url to the empty string to suppress automatic downloading. If the .daily file is older than download-delay (=1.weeksstd/time/duration/weeks: (n : int) -> duration) the file is automatically refreshed from url. The download-timeout (=5.seconds) gives the maximum time for downloading to finish (daily file is about 40kb). If the .all file is older than 8*download-delay the file is automatically refreshed from url. The 4*download-timeout (=20.seconds) gives the maximum time for downloading to finish (.all file is about 3mb). Set the optional parameter verbose to Falsestd/core/False: bool to suppress trace messages on downloads or errors.

The default UT2 (Universal time 2) timescale. Uses builtin approximation of UT2 time as described in deltatstd/time/ut1/deltat: (i : instant, dt-override : ?(i : instant) -> maybe<duration>) -> duration. To calculate UT2 more precisely, use cal-ut2-load (or cal-ut2-create).

Takes an optional dt parameter to calculate ΔT (=TT - UT1) more precisely (since UT2 is derived from UT1). The dt functions should return Nothingstd/core/Nothing: forall<a> maybe<a> for instants outside its range so the builtin methods can be used in that case (see deltatstd/time/ut1/deltat: (i : instant, dt-override : ?(i : instant) -> maybe<duration>) -> duration).