help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Windows file timestamp converted to local time
Date: Tue, 17 Oct 2023 19:28:45 +0300	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On 2023-10-17 17:13, Matt Borchers wrote:
> On Monday, October 16, 2023 at 2:49:52 PM UTC-4, Niklas Holsti wrote:
>> On 2023-10-16 21:35, Matt Borchers wrote:
>>> Below is the function from System.OS_Lib.
>>> Does anybody know where the C implementation can be found?
>>> Does anybody know where the C implementation of "localtime" is found?
>>> function File_Time_Stamp (Name : C_File_Name) return OS_Time is
>>> function File_Time (Name : Address) return OS_Time;
>>> pragma Import (C, File_Time, "__gnat_file_time_name");
>>> begin
>>> return File_Time (Name);
>>> end File_Time_Stamp;
>> (This question seems to be a follow-up ("Re:") to some earlier post, but
>> my newsreader does not seem to find or show that earlier post.)
>> What is the problem?
>> Have you tried using the standard Ada services:
>> Ada.Directories.Modification_Time and
>> Ada.Calendar.Time_Zones.Local_Time_Offset?
> Thank you for the suggestion of using "Ada.Directories.Modification_Time".

Happy to help!

> I didn't think to look in that package.

Ada.Directories does, IMO, seem the best place for it, since it should 
not depend on the type of the file -- text, sequential, etc.

> This function adjusts for daylight savings time and returns the time
> as displayed in Windows Explorer.
> There needs to be better comments (and documentation) for these time
> related functions. It is often not clear what time is returned.

Yes, but some of that documentation should not be in the Ada standard, 
but in the compiler's documentation.

Ada.Directories.Modification_Time returns a value of type 
Ada.Calendar.Time. However, "the time base associated with the type Time 
of package Calendar is implementation defined" (RM 9.6(23)) so it should 
be documented in the implementation documents, that is in the GNAT 
documentation. Have you looked there?

  reply	other threads:[~2023-10-17 16:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
2023-10-16 18:35 ` Windows file timestamp converted to local time Matt Borchers
2023-10-16 18:49   ` Niklas Holsti
2023-10-17  2:39     ` Randy Brukardt
2023-10-17 14:13     ` Matt Borchers
2023-10-17 16:28       ` Niklas Holsti [this message]
2023-10-17 16:35         ` Simon Wright
2023-10-16 19:14   ` Simon Wright
2023-10-17  7:25   ` 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