[M3devel] subsecond resolution on file times?
Jay
jay.krell at cornell.edu
Mon Mar 9 08:21:25 CET 2009
eh? We've got sub-second resolution, why not keep it?
C:\dev2\cm3.2\m3-libs\libm3\src\os\POSIX\FSPosix.m3
PROCEDURE SetModificationTime(pn: Pathname.T; READONLY t: Time.T)
RAISES {OSError.E}=
CONST Accessed = 0; Updated = 1;
VAR u: ARRAY [Accessed .. Updated] OF Utime.struct_timeval;
fname := M3toC.SharedTtoS(pn);
BEGIN
u[Updated].tv_sec := ROUND(t); u[Updated].tv_usec := 0;
u[Accessed].tv_sec := ROUND(Time.Now()); u[Accessed].tv_usec := 0;
IF Unix.utimes(fname, ADR(u)) < 0 THEN Fail(pn, fname); END;
M3toC.FreeSharedS(pn, fname);
END SetModificationTime;
http://www.opengroup.org/onlinepubs/009695399/functions/utimes.html
"The times in the timeval structure are measured in seconds and microseconds since the Epoch, although rounding toward the nearest second may occur."
Rounding may occur, but won't necessarily.
Are there systems that fail if tv_usec != 0?
This is what TimePosix.ToUtime is for, eh?
I was looking to see if I could remove Usysdep.struct_timeval, as part of reducing/eliminating Usysdep.
The opengroup link says to use utime() instead of utimes() for portability?
True? I'm skeptical.
- Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20090309/73c1c51e/attachment-0001.html>
More information about the M3devel
mailing list