* simple time display
@ 1997-01-15 0:00 Noam Kloos
1997-01-16 0:00 ` Jerome Desquilbet
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Noam Kloos @ 1997-01-15 0:00 UTC (permalink / raw)
In a book i read:
package durationIO is new ada.text_io.decimal_io(DURATION);
use durationIO;
gnat on sun and linux cannot instantiate durationIO because it wants a
decimal type for its parameter Num.
What whould be the simplest way to just pprint the current time in ada?
Regards,
Noam.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: simple time display
1997-01-15 0:00 simple time display Noam Kloos
@ 1997-01-16 0:00 ` Jerome Desquilbet
1997-01-16 0:00 ` Jerome Desquilbet
1997-01-25 0:00 ` Robert Dewar
2 siblings, 0 replies; 4+ messages in thread
From: Jerome Desquilbet @ 1997-01-16 0:00 UTC (permalink / raw)
To: Noam Kloos
> What whould be the simplest way to just pprint the current time in
> ada?
My previous message just explained how to print a Duration object.
If you want to print the current time, you have to use Ada.Calendar.
For example:
with Ada.Text_Io;
use Ada.Text_Io;
with Ada.Calendar;
use Ada.Calendar;
procedure Print_Current_Date is
Current_Time : Time := Clock;
Current_Year : Year_Number := Year (Current_Time);
Current_Month : Month_Number := Month (Current_Time);
Current_Day : Day_Number := Day (Current_Time);
begin
Put_Line (Year_Number'Image (Current_Year) &
Month_Number'Image (Current_Month) &
Day_Number'Image (Current_Day));
end Print_Current_Date;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: simple time display
1997-01-15 0:00 simple time display Noam Kloos
1997-01-16 0:00 ` Jerome Desquilbet
@ 1997-01-16 0:00 ` Jerome Desquilbet
1997-01-25 0:00 ` Robert Dewar
2 siblings, 0 replies; 4+ messages in thread
From: Jerome Desquilbet @ 1997-01-16 0:00 UTC (permalink / raw)
To: Noam Kloos
> package durationIO is new ada.text_io.decimal_io(DURATION);
> use durationIO;
>
> [...] cannot instantiate durationIO because it wants a
> decimal type for its parameter Num.
>
> What whould be the simplest way to just pprint the current time in
> ada?
with Ada.Text_Io;
procedure Test is
package Duration_Io is new Ada.Text_Io.Fixed_Io (Duration);
D : Duration := Duration'Small;
begin
Ada.Text_Io.Put_Line (Duration'Image (D));
Duration_Io.Put (D);
Ada.Text_Io.New_Line;
end Test;
______________________________________________________________________
Jerome Desquilbet jDesquilbet@Rational.COM
' ^
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: simple time display
1997-01-15 0:00 simple time display Noam Kloos
1997-01-16 0:00 ` Jerome Desquilbet
1997-01-16 0:00 ` Jerome Desquilbet
@ 1997-01-25 0:00 ` Robert Dewar
2 siblings, 0 replies; 4+ messages in thread
From: Robert Dewar @ 1997-01-25 0:00 UTC (permalink / raw)
Noam said
"In a book i read:
package durationIO is new ada.text_io.decimal_io(DURATION);
use durationIO;
What book? This is clearly nonsense, Duration is an ordinary fixed point
type, not a decimal fixed point type!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1997-01-25 0:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-01-15 0:00 simple time display Noam Kloos
1997-01-16 0:00 ` Jerome Desquilbet
1997-01-16 0:00 ` Jerome Desquilbet
1997-01-25 0:00 ` Robert Dewar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox