Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

SETFILETIMEQQ

Portability Function: Sets the modification time for a specified file.

Module

USE IFPORT

result = SETFILETIMEQQ (filename,timedate)

filename

(Input) Character*(*). Name of a file.

timedate

(Input) INTEGER(4). Time and date information, as packed by PACKTIMEQQ.

Results

The result type is LOGICAL(4). The result is .TRUE. if successful; otherwise, .FALSE..

The modification time is the time the file was last modified and is useful for keeping track of different versions of the file. The process that calls SETFILETIMEQQ must have write access to the file; otherwise, the time cannot be changed. If you set timedate to FILE$CURTIME (defined in IFPORT.F90), SETFILETIMEQQ sets the modification time to the current system time.

If the function fails, call GETLASTERRORQQ to determine the reason. It can be one of the following:

  • ERR$ACCES - Permission denied. The file's (or directory's) permission setting does not allow the specified access.

  • ERR$INVAL - Invalid argument; the timedate argument is invalid.

  • ERR$MFILE - Too many open files (the file must be opened to change its modification time).

  • ERR$NOENT - File or path not found.

  • ERR$NOMEM - Not enough memory is available to execute the command; or the available memory has been corrupted; or an invalid block exists, indicating that the process making the call was not allocated properly.

Example

 USE IFPORT
 INTEGER(2) day, month, year
 INTEGER(2) hour, minute, second, hund
 INTEGER(4) timedate
 LOGICAL(4) result

 CALL GETDAT(year, month, day)
 CALL GETTIM(hour, minute, second, hund)
 CALL PACKTIMEQQ (timedate, year, month, day,    &
                  hour, minute, second)
 result = SETFILETIMEQQ('myfile.dat', timedate)
 END