comp.lang.ada
 help / color / mirror / Atom feed
From: "Des Walker" <des.walker@dessy.fsnet.co.uk>
Subject: Re: Time to float??
Date: Sun, 30 Sep 2001 22:36:48 +0100
Date: 2001-09-30T21:36:15+00:00	[thread overview]
Message-ID: <9p838f$2fl$1@newsg1.svr.pol.co.uk> (raw)
In-Reply-To: 3BB78935.33B5C91A@ida.his.se


Michael Andersson <a98mican@ida.his.se> wrote in message
news:3BB78935.33B5C91A@ida.his.se...
> Hi!
> Could somebody please show me how to convert Ada.Real_time type Time
to
> a float so that for example 1.5 seconds is represented as the real
> number 1.5.
>
> Thanks!
> /Michael Andersson

I wonder if what you want is to convert a Time_Span type rather than a
Time type value. A value of type Time is more likely to be a form of
'10:21pm, 30 September 2001', and a Time_Span type a form of 1.5
seconds. (Subtract two Ada.Real_Time.Time values and the function
provided in the Ada.Real _Time package provides an
Ada.Real_Time.Time_Span type value)

Ada.Real_Time provides the To_Duration function to convert an
Ada.Real_Time.Time_Span value to a Duration. You can cast this to a real
floating type, or you can use Duration'Image if you're printing the
result.

    Regards
    Des Walker






  reply	other threads:[~2001-09-30 21:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-30 15:01 Time to float?? Michael Andersson
2001-09-30 21:36 ` Des Walker [this message]
2001-09-30 21:56   ` Des Walker
2001-09-30 23:18 ` Robert Dewar
2001-10-01 13:54   ` Ted Dennison
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox