Some calendar utility functions.
More...Date_Time_Image | |
Date_Time_Wide_Image | |
Date_Time_Wide_Wide_Image | |
Duration_Image | |
Duration_Wide_Image | |
Duration_Wide_Wide_Image | |
Split_Duration | |
To_Second_Duration | |
To_Second_Number |
No, I have not created some new Calendar class - yet. Just a few calendar tools.
64 | function Date_Time_Image |
---|---|
65 | (Date : Ada.Calendar.Time; |
66 | Fraction_Digits : Natural := 1) |
67 | return String with |
68 | Pure_Function, Post => Date_Time_Image'Result'Length = 20 + Fraction_Digits; |
Image representation with Fractional seconds.
value to create the image from
amount of fractional digits to add.
76 | function Date_Time_Wide_Image |
---|---|
77 | (Date : Ada.Calendar.Time; |
78 | Fraction_Digits : Natural := 1) |
79 | return Wide_String is |
80 | (Ada.Characters.Conversions.To_Wide_String (Date_Time_Image (Date, Fraction_Digits))) with |
81 | Pure_Function, Inline, Post => Date_Time_Wide_Image'Result'Length = 20 + Fraction_Digits; |
Wide image representation with Fractional seconds.
value to create the image from
amount of fractional digits to add.
89 | function Date_Time_Wide_Wide_Image |
---|---|
90 | (Date : Ada.Calendar.Time; |
91 | Fraction_Digits : Natural := 1) |
92 | return Wide_Wide_String is |
93 | (Ada.Characters.Conversions.To_Wide_Wide_String (Date_Time_Image (Date, Fraction_Digits))) with |
94 | Pure_Function, Inline, Post => Date_Time_Wide_Wide_Image'Result'Length = 20 + Fraction_Digits; |
Wide wide image representation with Fractional seconds.
value to create the image from
amount of fractional digits to add.
103 | function Duration_Image |
---|---|
104 | (Seconds : Duration; |
105 | Hour_Digits : Positive := 4; |
106 | Fraction_Digits : Natural := 1) |
107 | return String with |
108 | Pure_Function, |
109 | Pre => Hour_Digits >= 2 and then Seconds <= 3_600.0 * (10**Hour_Digits), |
110 | Post => Duration_Image'Result'Length = Hour_Digits + 7 + Fraction_Digits; |
Image representation of a Duration in the form HHHH:MM:SStttt
value to create the image from
amount of digits for the hour to add.
amount of fractional digits to add.
119 | function Duration_Wide_Image |
---|---|
120 | (Seconds : Duration; |
121 | Hour_Digits : Positive := 4; |
122 | Fraction_Digits : Natural := 1) |
123 | return Wide_String is |
124 | (Ada.Characters.Conversions.To_Wide_String (Duration_Image (Seconds, Hour_Digits, Fraction_Digits))) with |
125 | Pure_Function, |
126 | Inline, |
127 | Pre => Hour_Digits >= 2 and then Seconds <= 3_600.0 * (10**Hour_Digits), |
128 | Post => Duration_Wide_Image'Result'Length = Hour_Digits + 7 + Fraction_Digits; |
Image representation of a Duration in the form HHHH:MM:SStttt
value to create the image from
amount of digits for the hour to add.
amount of fractional digits to add.
137 | function Duration_Wide_Wide_Image |
---|---|
138 | (Seconds : Duration; |
139 | Hour_Digits : Positive := 4; |
140 | Fraction_Digits : Natural := 1) |
141 | return Wide_Wide_String is |
142 | (Ada.Characters.Conversions.To_Wide_Wide_String (Duration_Image (Seconds, Hour_Digits, Fraction_Digits))) with |
143 | Pure_Function, |
144 | Inline, |
145 | Pre => Hour_Digits >= 2 and then Seconds <= 3_600.0 * (10**Hour_Digits), |
146 | Post => Duration_Wide_Wide_Image'Result'Length = Hour_Digits + 7 + Fraction_Digits; |
Image representation of a Duration in the form HHHH:MM:SStttt
value to create the image from
amount of digits for the hour to add.
amount of fractional digits to add.
34 | procedure Split_Duration |
---|---|
35 | (Seconds : Duration; |
36 | Hour : out Natural; |
37 | Minute : out Ada.Calendar.Formatting.Minute_Number; |
38 | Second : out Ada.Calendar.Formatting.Second_Number; |
39 | Sub_Second : out Ada.Calendar.Formatting.Second_Duration); |
54 | function To_Second_Duration |
---|---|
55 | (Seconds : Ada.Calendar.Day_Duration) return Ada.Calendar.Formatting.Second_Duration with |
56 | Pure_Function; |
Convert a Day_Duration into Second_Duration — which is basically the fraction part of the duration
to convert
the Second_Duration of the duration
46 | function To_Second_Number (Seconds : Ada.Calendar.Day_Duration) return Ada.Calendar.Formatting.Second_Number with |
---|---|
47 | Pure_Function; |
Convert a Day_Duration into Second_Number — which is basically the integer part of the duration
to convert
the Second_Number of the duration