3 #include <dos/datetime.h>
8 char day
[LEN_DATSTRING
];
9 char time
[LEN_DATSTRING
];
10 char date
[LEN_DATSTRING
];
11 struct DateStamp stamp
;
13 curr
.dat_Format
= FORMAT_DOS
;
15 curr
.dat_StrDay
= day
;
16 curr
.dat_StrDate
= date
;
17 curr
.dat_StrTime
= time
;
19 DateStamp(&curr
.dat_Stamp
);
21 Printf("Current time: %s, %s, %s\n", day
, date
, time
);
23 BPTR fh
= Open("__TEST__", MODE_NEWFILE
);
27 struct FileInfoBlock
*fib
= AllocDosObject(DOS_FIB
, NULL
);
31 if (ExamineFH(fh
, fib
))
33 curr
.dat_Stamp
= fib
->fib_Date
;
35 Printf("File modification time: %s, %s, %s\n", day
, date
, time
);
38 PrintFault(IoErr(), "Examine failed");
40 Printf("Waiting 5 seconds\n");
45 Printf("Calling SetFileDate\n");
46 if(SetFileDate("__TEST__", &stamp
)) {
47 if (ExamineFH(fh
, fib
))
49 curr
.dat_Stamp
= fib
->fib_Date
;
51 Printf("New file modification time: %s, %s, %s\n", day
, date
, time
);
54 PrintFault(IoErr(), "Examine failed");
57 PrintFault(IoErr(), "SetFileDate");
59 FreeDosObject(DOS_FIB
, fib
);
62 PrintFault(IoErr(), "Couldn't alloc FileInfoBlock");
65 DeleteFile("__TEST__");
68 PrintFault(IoErr(), "Couldn't create file");