Size: 1165
Comment:
|
Size: 1270
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 9: | Line 9: |
* https://docs.adacore.com/gnat_rm-docs/html/gnat_rm/gnat_rm/the_gnat_library.html | |
Line 26: | Line 27: |
use ada.text_io; | |
Line 27: | Line 29: |
use gnat.calendar.time_io; | |
Line 28: | Line 31: |
use ada.calendar; | |
Line 30: | Line 34: |
datetime: string(1..26); -- has exactly 22 chars | datetime: string(1..26); -- has exactly 26 chars |
Line 33: | Line 37: |
datetime := gnat.calendar.time_io.image( ada.calendar.clock, "[%Y-%m-%dT%H:%M:%S.%i] " ); | datetime := image( clock, "[%Y-%m-%dT%H:%M:%S.%i] " ); |
Line 35: | Line 39: |
ada.text_io.put_line( datetime & "stuff " ); | put_line( datetime & "stuff " ); |
Line 37: | Line 41: |
Ada
https://craftofcoding.files.wordpress.com/2013/07/ada_strings.pdf
https://www.adaic.org/resources/add_content/standards/05rm/html/RM-TOC.html
https://en.wikibooks.org/wiki/Ada_Programming/Libraries/GNAT.Calendar.Time_IO
https://docs.adacore.com/gnat_rm-docs/html/gnat_rm/gnat_rm/the_gnat_library.html
Hello world
hello.adb
- gnat make hello.adb
Hello date
hellodate.adb
1 with ada.text_io;
2 use ada.text_io;
3 with gnat.calendar.time_io;
4 use gnat.calendar.time_io;
5 with ada.calendar;
6 use ada.calendar;
7
8 procedure HelloDate is
9 datetime: string(1..26); -- has exactly 26 chars
10 begin
11 -- gets date to string with milliseconds
12 datetime := image( clock, "[%Y-%m-%dT%H:%M:%S.%i] " );
13 -- concatenetas string and shows date
14 put_line( datetime & "stuff " );
15 end HelloDate;
- gnat make hellodate.adb