@node _dos_getftime, dos @findex _dos_getftime @subheading Syntax @example #include unsigned int _dos_getftime(int handle, unsigned int *p_date, unsigned *p_time); @end example @subheading Description This function gets the date and time of the given file and puts these values into @var{p_date} and @var{p_time} variable. The meaning of DOS date in the @var{p_date} variable is the following: @example F E D C B A 9 8 7 6 5 4 3 2 1 0 (bits) X X X X X X X X X X X X X X X X *-----------------------* *-----------* *---------------* year month day year = 0-119 (relative to 1980) month = 1-12 day = 1-31 @end example The meaning of DOS time in the @var{p_time} variable is the following: @example F E D C B A 9 8 7 6 5 4 3 2 1 0 X X X X X X X X X X X X X X X X *---------------* *-------------------* *---------------* hours minutes seconds hours = 0-23 minutes = 0-59 seconds = 0-29 in two-second intervals @end example @xref{_dos_setftime}. This function cannot be used to return last access and creation date and time, even on systems where the LFN API (@pxref{_use_lfn, LFN}) is available. See @ref{_lfn_get_ftime}, for a function that can be used to get the other two times. Also see @ref{fstat}, which is Posix-standard. @subheading Return Value Returns 0 if successful and return DOS error on error (and sets @code{errno}=EBADF). @subheading Portability @portability !ansi, !posix @subheading Example @example unsigned int handle, date, time; _dos_open("FOO.DAT", O_RDWR, &handle); _dos_getftime(handle, &date, &time); _dos_close(handle); printf("FOO.DAT date and time is: %04u-%02u-%02u %02u:%02u:%02u.\n", /* year month day */ ((date >> 9) & 0x7F) + 1980U, (date >> 5) & 0x0F, date & 0x1F, /* hour minute second */ (time >> 11) & 0x1F, (time >> 5) & 0x3F, (time & 0x1F) * 2); @end example