xcall MIAMEX, MX_FILETIMES, fspec, op {status {,mtime {,ctime {,atime}}}}
MX_FILETIMES provides a way to set a file's last modification time (mtime), creation time (ctime), and/or last access time (atime). Setting the mtime of a file is equivalent in the UNIX world to using the touch command on the file. For convenience, the function can also retrieve the file times, overlapping functionality already provided by MX_FILESTATS.
Parameters
fspec (str) [in]
native or AMOS-style file specification of file
op (num) [in]
0 to get the current times, 1 to set them
status (signed num) [out]
returns 0 for success, else an error code (file not found, etc.)
mtime, ctime, atime (T_FILETIME or B,4) [in/out depending on op]
UNIX-style file times, i.e. seconds since "the epoch" (midnight Jan 1, 1970). (This is the same format as is used for MX_FILESTATS.) When op = 1 (set), any time parameters either omitted or set to 0 will result in no change to the corresponding time attribute; -1 (or &hffffffff) may be used as a shortcut for the current time.
Notes
• T_FILETIME is defined in ashinc:types.def as B,4
• You can use the MX_FTFORMAT function to convert these time values to other formats.
• To convert other time formats to the T_FILETIME format, you can use the Fn'Date'Time'tO'FILETIME() function from fndatetime.bsi in SOSLIB[907,10].
• The operating system may impose limits and/or perform cleanup on your attempts to set file times. For example, in the UNIX world, the ctime value isn't really the "creation" time but the time that the file's metadata was last changed, and there is no direct way to change it. However, changing either the mtime or atime will indirectly set the ctime to match.
Examples
Set the modification time of the file fspec$ to the current time. Note that the literal -1 will be auto-converted to the T_FILETIME (B,4) format:
xcall MIAMEX, MX_FILETIMES, fspec$, MXOP_SET, status, -1
Get the mtime and ctime and display the mtime in human readable form:
xcall MIAMEX, MX_FILETIMES, fspec$, MXOP_GET, status, mtime, ctime
xcall MIAMEX, MX_FTFORMAT, mtime, strtime$
? "Last mod time of ";fspec$;" was: ";strtime$