|Version 2 (modified by 10 years ago) ( diff ),|
This module will be available in Matreshka 0.1.0
Matreshka provides support for date/time operations, including such complicated things as calendars, time zones, leap seconds, and localization. All complexity is hidden under simple API for applications.
Matreshka provides three types to represent date/time related information in the League.Calendars package:
- Time - represents time inside one day;
- Date - represents date;
- Date_Time - represents date/time information. Unlike two previous types all operations on this type take in sense current or user specified time zone.
These types are used only to store information. Several additional packages are provided to extract components of date/time, to format and parse string representation of date/time and to manipulate by values of objects:
- League.Calendars.ISO_8601 - implements calendar operations as specified by ISO-8601 standard. It is based on proleptic Gregorian calendar with astronomical year numbering.
- League.Calendars.Gregorian - implements most useful mixed Gregorian/Julian calendar. Date of switch from Julian to Gregorian calendars depends from locale. There is no year number zero. Not yet implemented.
Below is small example of use of calendar support, it takes current date/time from system clock and output it to console.
with Ada.Wide_Wide_Text_IO; with League.Calendars.ISO_8601; with League.Strings; procedure Main is X : League.Calendars.Date_Time := League.Calendars.Clock; begin Ada.Wide_Wide_Text_IO.Put_Line (League.Calendars.ISO_8601.Image (League.Strings.To_Universal_String ("yyyy-MM-dd HH:mm:ss"), X).To_Wide_Wide_String); end Main;