How to convert Ada.Real_TIme.Time to string?

I would like to write Ada.Real_Time.Time in a file,

How can i do this?

thank

+3
source share
4 answers

The Ada.Real_time package does not provide a method for direct format.

I would advise you to take a look at Ada.Calendar.Formatting. You have a Clock method, as in Ada.Real_time. Indeed, there is an Image (parameters: Time) method that returns a String.

Read more: Package: Ada.Calendar.Formatting

+3
source

Ada.Real_Time.Split Ada.Real_Time.Time (a) , Ada.Real_Time.Seconds_Count (b) , () Ada.Real_Time.Time_Span; Ada.Real_Time.To_Duration Duration.

Ada.Real_Time.Seconds_Count'Image Duration'Image String.

? , - , , , ; , .

+5

Ada.Real_Time.Split(), Time Seconds_Count Time_Span. Seconds_Count - , , Time_Span - ( ) Time_Units . . D.8 (29).

Seconds_Count , Time_Span Duration To_Duration().

Note that you can invert the process and use Time_Of () to restore the time value.

+3
source

If you do not need this text as readable text, but just want it to be saved in a file, you can try using the stream output attribute ( 'Write)

+2
source

Source: https://habr.com/ru/post/1747866/


All Articles