comp.lang.ada
 help / color / mirror / Atom feed
* GNAT Modification_Time limitation
@ 2018-11-19 22:56 Lionel Draghi
  2018-11-20  0:47 ` Shark8
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Lionel Draghi @ 2018-11-19 22:56 UTC (permalink / raw)


I am coding a kind of make application, that depends on file's time tag (thanks to Ada.Directories.Modification_Time), and on Ada.Calendar.Clock, both returning Ada.Calendar.Time.

Unfortunately, I came across a GNAT limitation in the Modification_Time implementation on Linux : sub-second are ignored, and Modification_Time returns 
> Time_Of (Year, Month, Day, Hour, Minute, Second, 0.0);

So, at the same time Clock returns 2018-10-29 20:36:01.47
while Modification_Time    returns 2018-10-29 20:36:01.00

This prevents me from knowing if a file is modified before or after certain time, and thus undermine my efforts.

My workaround was to impair also Clock precision, with an ugly rounding:
> Time := Ada.Calendar.Clock;
> New_Time := Time_Of
>   (Year    => Year (Time),
>    Month   => Month (Time),
>    Day     => Day (Time),
>    Seconds => Day_Duration (Float'Floor (Float (Seconds (Time)))));

But that's not a correct solution either : I have to order lots of file creation, and having all files created during the same second returning the same time tag also prevent my algorithm from properly working.

Any workaround to get a precise file time tag? 
Or to compare file's time tag with Clock?

Thanks,

--
Lionel  


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2018-11-26 23:45 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-19 22:56 GNAT Modification_Time limitation Lionel Draghi
2018-11-20  0:47 ` Shark8
2018-11-20  1:33   ` Keith Thompson
2018-11-20  1:33 ` Keith Thompson
2018-11-20 23:32   ` Randy Brukardt
2018-11-21  8:23     ` Dmitry A. Kazakov
2018-11-20  8:08 ` briot.emmanuel
2018-11-20 11:57   ` Lionel Draghi
2018-11-21  7:40     ` briot.emmanuel
2018-11-21 11:16       ` briot.emmanuel
2018-11-21 19:13         ` Lionel Draghi
2018-11-21 19:02       ` Lionel Draghi
2018-11-21 19:48         ` Simon Wright
2018-11-21 22:14           ` Lionel Draghi
2018-11-20 23:53   ` Randy Brukardt
2018-11-21  7:31     ` briot.emmanuel
2018-11-21 14:38       ` Shark8
2018-11-21 17:32       ` Simon Wright
2018-11-21 17:43         ` briot.emmanuel
2018-11-21 23:34       ` Randy Brukardt
2018-11-22  8:15         ` briot.emmanuel
2018-11-26 23:45           ` Randy Brukardt

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