tags:

views:

683

answers:

3

The title says it all... need to know how to print a Time variable in Ada. I assume there is no portable way because Time is implementation defined. I've already seen the GNAT.Calendar.Formatting package available under GNAT, I'd also be interested in a GHS for VME.

+1  A: 

Sure, time output can be portable, Ada.Calendar contains standard functions that extract the components of a time value, so it's straightforward to put together your own conversion package.

For example, here's one. One just needs to either create a minor addition to create a "Formatted_Time" record for a given Time value (see the package's Get_Time() function for guidance), or make Main_Formatter() visible in the package spec.

Marc C
+1  A: 

Generally what I do is use Calendar.Split and then do a 'image on the parts I care about.

T.E.D.
+2  A: 

See package "Ada.Calendar.Formatting" function "Image" for Ada2005. If you have an Ada95 compiler you could and this package isn't available, try my implementation from here

This was written using GNAT 3.15p, so pretty old.

YermoungDer