Skip to content

propensive/aviation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Workflow

Aviation

Representations of time, in its various forms

The representation of time is complex, in part because the domain is intrinsically complicated, and in part because we mean by "time" is different in different contexts. Aviation is an attempt to rationalize this complexity by providing immutable representations of a variety concepts relating to time and operations between them, taking advantage of the opportunities Scala offers to make these APIs as intuitive as possible.

Features

  • representations points in time and lengths of time, in both exact/universal and civil forms
  • types are all immutable and typesafe
  • intuitive constructors for civil date and time values
  • customisable rules for adding civil time units
  • supports different calendar systems
  • use and convert between different timezones and calendar systems

Availability Plan

Aviation has not yet been published. The medium-term plan is to build Aviation with Fury and to publish it as a source build on Vent. This will enable ordinary users to write and build software which depends on Aviation.

Subsequently, Aviation will also be made available as a binary in the Maven Central repository. This will enable users of other build tools to use it.

For the overeager, curious and impatient, see building.

Getting Started

Aviation provides a variety of types representing and working with different time-related concepts.

On Time

Time is a complicated concept in several ways. On a physical abstraction, we can pinpoint an instant in time and order it as happening before or after another instant, provided they happen in the same place. We can consider the difference between two instants, and measure it by comparison to reference events that occur with a known regularly. We can relate time to distance using the speed of light, to partially order events in different locations.

In a geological and heliocentric context, we talk about instants and durations with reference to the rotation of the Earth around the sun, the rotation of Earth on its axis, and the phase of the moon, as well as with arbitrary subdivisions based on historical convention and highly composite numbers, and sometimes religious convention.

The measurements we use may have different meanings in different locations on Earth (or conversely, the same measurement may be represented differently in different locations), and different systems for representing the measurements have been in use at different times in different places. The relationships between different units of measurement are not usually decimal, not always constant, not always exact subdivisions, and may not even be known in advance. The same representation may refer to distinct events in the same place, and some representations may not represent valid events on a handful of occasions. The system of representation may depend on the prevailing political authority at the time, which can depend on war.

Aviation makes an ambitious effort to rationalize, systematize and encode as much of this complexity as possible.

Instants and Durations

We can represent a moment in time, without reference to any other macroscopic entity (such as the Earth, and units derived from it), as an Instant. An Instant is represented, internally, as a 64-bit integer corresponding to the number of non-leap milliseconds since the UNIX epoch.

The difference between two Instants is represented as a Duration, and represented internally as a 64-bit integral number of milliseconds.

International Atomic Time (TAI)

In addition to Instants (which do not distinguish leap seconds from the second immediately preceding it), TaiInstant implements an instant in International Atomic Time (TAI) which has no discontinuity at each leap second.

Although the concept of an "instant" and, in particular, the "duration" between any two instants ought to be unambiguous, it is not. This is due to the existence of leap seconds, each of which increments the difference between the numbers we use to represent the time in UNIX time (or UTC) and TAI. Since 1972 (when UTC and UNIX time already differed from TAI by ten seconds), twenty-seven leap seconds have been added, either at the end or the middle of the year. These were corrections, based on precise observations of the tiny deviations in the Earth's movement which change its rate of rotation over the previous months, to try to maintain the invariant that the sun's maximum elevation above the Greenwich Meridian (Solar Noon) should be within one second of Clock Noon (i.e. the time at which the clock digits read 12:00:00).

Status

Aviation is classified as fledgling. For reference, Scala One projects are categorized into one of the following five stability levels:

  • embryonic: for experimental or demonstrative purposes only, without any guarantees of longevity
  • fledgling: of proven utility, seeking contributions, but liable to significant redesigns
  • maturescent: major design decisions broady settled, seeking probatory adoption and refinement
  • dependable: production-ready, subject to controlled ongoing maintenance and enhancement; tagged as version 1.0.0 or later
  • adamantine: proven, reliable and production-ready, with no further breaking changes ever anticipated

Projects at any stability level, even embryonic projects, can still be used, as long as caution is taken to avoid a mismatch between the project's stability level and the required stability and maintainability of your own project.

Aviation is designed to be small. Its entire source code currently consists of 789 lines of code.

Building

Aviation will ultimately be built by Fury, when it is published. In the meantime, two possibilities are offered, however they are acknowledged to be fragile, inadequately tested, and unsuitable for anything more than experimentation. They are provided only for the necessity of providing some answer to the question, "how can I try Aviation?".

  1. Copy the sources into your own project

    Read the fury file in the repository root to understand Aviation's build structure, dependencies and source location; the file format should be short and quite intuitive. Copy the sources into a source directory in your own project, then repeat (recursively) for each of the dependencies.

    The sources are compiled against the latest nightly release of Scala 3. There should be no problem to compile the project together with all of its dependencies in a single compilation.

  2. Build with Wrath

    Wrath is a bootstrapping script for building Aviation and other projects in the absence of a fully-featured build tool. It is designed to read the fury file in the project directory, and produce a collection of JAR files which can be added to a classpath, by compiling the project and all of its dependencies, including the Scala compiler itself.

    Download the latest version of wrath, make it executable, and add it to your path, for example by copying it to /usr/local/bin/.

    Clone this repository inside an empty directory, so that the build can safely make clones of repositories it depends on as peers of aviation. Run wrath -F in the repository root. This will download and compile the latest version of Scala, as well as all of Aviation's dependencies.

    If the build was successful, the compiled JAR files can be found in the .wrath/dist directory.

Contributing

Contributors to Aviation are welcome and encouraged. New contributors may like to look for issues marked beginner.

We suggest that all contributors read the Contributing Guide to make the process of contributing to Aviation easier.

Please do not contact project maintainers privately with questions unless there is a good reason to keep them private. While it can be tempting to repsond to such questions, private answers cannot be shared with a wider audience, and it can result in duplication of effort.

Author

Aviation was designed and developed by Jon Pretty, and commercial support and training on all aspects of Scala 3 is available from Propensive OÜ.

Name

Tempus fugit, or, time flies.

In general, Scala One project names are always chosen with some rationale, however it is usually frivolous. Each name is chosen for more for its uniqueness and intrigue than its concision or catchiness, and there is no bias towards names with positive or "nice" meanings—since many of the libraries perform some quite unpleasant tasks.

Names should be English words, though many are obscure or archaic, and it should be noted how willingly English adopts foreign words. Names are generally of Greek or Latin origin, and have often arrived in English via a romance language.

Logo

The logo shows a bird, the archetype of aviation, ascending in front of a setting sun.

License

Aviation is copyright © 2024 Jon Pretty & Propensive OÜ, and is made available under the Apache 2.0 License.