| www.delorie.com/djgpp/doc/libc-2.01/libc_139.html | search |
#include <dos.h> unsigned int _dos_getftime(int handle, unsigned int *p_date, unsigned *p_time);
This function gets the date and time of the given file and puts these values into p_date and p_time variable. The meaning of DOS date in the p_date variable is the following:
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
The meaning of DOS time in the p_time variable is the following:
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
See section _dos_setftime.
Returns 0 if successful and return DOS error on error (and sets errno=EBADF).
unsigned int handle, date, time;
_dos_open("FOO.DAT", O_RDWR, &handle);
_dos_gettime(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);
Go to the first, previous, next, last section, table of contents.
| prev next webmaster | delorie software privacy |
| Copyright © 1997 | Updated Apr 1997 |