| www.delorie.com/djgpp/doc/libc-2.01/libc_147.html | search |
#include <dos.h> unsigned int _dos_setftime(int handle, unsigned int date, unsigned time);
This function sets the date and time of the given file. The meaning of DOS date in the 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 time 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 *-------* *---------* *-------* hours minutes seconds hours = 0-23 minutes = 0-59 seconds = 0-29 in two-second intervals
See section _dos_getftime.
Returns 0 if successful and return DOS error on error (and sets errno=EBADF).
struct dosdate_t d;
struct dostime_t t;
unsigned int handle, date, time;
_dos_open("FOO.DAT", O_RDWR, &handle);
_dos_getdate(&d);
_dos_gettime(&t);
date = ((d.year - 1980) << 9) | (d.month << 5) | d.day;
time = (t.hour << 11) | (t.minute << 5) | (t.second / 2);
_dos_settime(handle, date, time);
_dos_close(handle);
Go to the first, previous, next, last section, table of contents.
| prev next webmaster | delorie software privacy |
| Copyright © 1997 | Updated Apr 1997 |