comp.lang.ada
 help / color / mirror / Atom feed
From: "Steve Doiel" <nospam_steved94@attbi.com>
Subject: Re: FILETIME <-> Ada.Real_Time.Time conversions
Date: Fri, 21 Dec 2001 03:13:37 GMT
Date: 2001-12-21T03:13:37+00:00	[thread overview]
Message-ID: <BNxU7.16478$NM4.3218496@rwcrnsc53> (raw)
In-Reply-To: 3c21f386.108560406@News.CIS.DFN.DE

> >Also note: it may not be possible (read probably isn't) to represent all
> >values of FILETIME as a Ada.Real_Time.Time value since the size of the
> >values may differ.  As I recall the resolution of time in Ada.Real_Time
is
> >not specified, but a minimum resolution and range is.
>
> We can definitely live with smaller range and/or precision. The real
> problem is that there is no correlation between epoch of
> Ada.Real_Time.Split and UTC.
>
> Regards,
> Dmitry Kazakov

Have you considered defining your own epoch in terms of both times?

You can determine the FILETIME value for your epoch using
SystemTimeToFileTime.  I'll call this file_time_epoch.  You only have to do
this once, then you can define the value as a program constant.

You can determine the Real_Time.Time value for your epoch using
Ada.Calendar.Time_Of.  I'll call this real_time_epoch.

To obtain a Real_Time.Time value from a subsequent FILETIME values use:

  real_time_value := real_time_epoch
                              + Ada.Real_Time.Nanoseconds( Integer(
file_time_value - file_time_epoch ) );

I'm sure you'll have to mess with the types to get things working, but I
think this will get you there.

SteveD






  reply	other threads:[~2001-12-21  3:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-18 12:53 FILETIME <-> Ada.Real_Time.Time conversions Dmitry A. Kazakov
2001-12-19  9:02 ` Alfred Hilscher
2001-12-19 13:37   ` Dmitry A. Kazakov
2001-12-19 15:06     ` Steve Doiel
2001-12-20 11:27       ` M. A. Alves
2001-12-20 15:10       ` Dmitry A. Kazakov
2001-12-21  3:13         ` Steve Doiel [this message]
2001-12-21 10:26           ` Dmitry A. Kazakov
2001-12-21 16:18             ` Steve Doiel
2001-12-24 18:02               ` Dmitry A. Kazakov
2001-12-21  6:17         ` tmoran
2001-12-21  8:51           ` Dmitry A. Kazakov
2001-12-21 18:17             ` tmoran
2001-12-24 15:59               ` Dmitry A. Kazakov
2001-12-24 18:21                 ` tmoran
2001-12-25 15:53                   ` Dmitry A. Kazakov
replies disabled

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