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?