* how to handle date and time
@ 1996-10-25 0:00 Noam Kloos
1996-10-28 0:00 ` Mike Bishop
1996-10-29 0:00 ` Michael Feldman
0 siblings, 2 replies; 3+ messages in thread
From: Noam Kloos @ 1996-10-25 0:00 UTC (permalink / raw)
Hello, how can I get the current time of my system. Im using Gnat for
Linux.
I guess its in the Calendar packgae but i have not found its specs.
There is a package Julian date but it does not handle time.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: how to handle date and time
1996-10-25 0:00 how to handle date and time Noam Kloos
@ 1996-10-28 0:00 ` Mike Bishop
1996-10-29 0:00 ` Michael Feldman
1 sibling, 0 replies; 3+ messages in thread
From: Mike Bishop @ 1996-10-28 0:00 UTC (permalink / raw)
Noam Kloos wrote:
>
> Hello, how can I get the current time of my system. Im using Gnat for
> Linux.
> I guess its in the Calendar packgae but i have not found its specs.
> There is a package Julian date but it does not handle time.
Calendar.Clock should give you want you want.
--
Mike Bishop
mikeb@wizard.unitedspacealliance.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: how to handle date and time
1996-10-25 0:00 how to handle date and time Noam Kloos
1996-10-28 0:00 ` Mike Bishop
@ 1996-10-29 0:00 ` Michael Feldman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Feldman @ 1996-10-29 0:00 UTC (permalink / raw)
In article <3270C5FD.13108478@3wis.nl>, Noam Kloos <noam@3wis.nl> wrote:
>Hello, how can I get the current time of my system. Im using Gnat for
>Linux.
>I guess its in the Calendar packgae but i have not found its specs.
Correct.
>There is a package Julian date but it does not handle time.
That's not a standard package; where did you find it?
Time of day is in Ada.Calendar. Here's a program that uses the desired
operations. Feel free to use it but do not remove the block comment at
the beginning.
The program was designed so that the average first-semester student
can understand it, so it's rather elementary in form, but it does
illustrates some of the operations.
You really should get an electronic copy of the RM from the web.
The html version at www.adahome.com is quite nice.
Mike Feldman
---
WITH Ada.Text_IO;
WITH Ada.Integer_Text_IO;
WITH Ada.Calendar;
PROCEDURE Time_of_Day IS
------------------------------------------------------------------
--| Displays the current time in hh:mm:ss form, 24-hour clock
--| Author: Michael B. Feldman, The George Washington University
--| Last Modified: July 1995
------------------------------------------------------------------
TYPE DayInteger IS RANGE 0..86400;
CurrentTime : Ada.Calendar.Time;
SecsPastMidnight : DayInteger;
MinsPastMidnight : Natural;
Secs : Natural;
Mins : Natural;
Hrs : Natural;
BEGIN -- Time_of_Day
CurrentTime := Ada.Calendar.Clock;
SecsPastMidnight := DayInteger(Ada.Calendar.Seconds(CurrentTime));
MinsPastMidnight := Natural(SecsPastMidnight/60);
Secs := Natural(SecsPastMidnight REM 60);
Mins := MinsPastMidnight REM 60;
Hrs := MinsPastMidnight / 60;
Ada.Text_IO.Put(Item => "The current time is ");
Ada.Integer_Text_IO.Put (Item => Hrs, Width => 1);
Ada.Text_IO.Put (Item => ':');
IF Mins < 10 THEN
Ada.Text_IO.Put (Item => '0');
END IF;
Ada.Integer_Text_IO.Put (Item => Mins, Width => 1);
Ada.Text_IO.Put (Item => ':');
IF Secs < 10 THEN
Ada.Text_IO.Put (Item => '0');
END IF;
Ada.Integer_Text_IO.Put (Item => Secs, Width => 1);
END Time_of_Day;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1996-10-29 0:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-10-25 0:00 how to handle date and time Noam Kloos
1996-10-28 0:00 ` Mike Bishop
1996-10-29 0:00 ` Michael Feldman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox