2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
8 #include <dos/datetime.h>
13 char day
[LEN_DATSTRING
];
14 char time
[LEN_DATSTRING
];
15 char date
[LEN_DATSTRING
];
16 struct DateStamp stamp
;
18 curr
.dat_Format
= FORMAT_DOS
;
20 curr
.dat_StrDay
= day
;
21 curr
.dat_StrDate
= date
;
22 curr
.dat_StrTime
= time
;
24 DateStamp(&curr
.dat_Stamp
);
26 Printf("Current time: %s, %s, %s\n", day
, date
, time
);
28 BPTR fh
= Open("__TEST__", MODE_NEWFILE
);
32 struct FileInfoBlock
*fib
= AllocDosObject(DOS_FIB
, NULL
);
36 if (ExamineFH(fh
, fib
))
38 curr
.dat_Stamp
= fib
->fib_Date
;
40 Printf("File modification time: %s, %s, %s\n", day
, date
, time
);
43 PrintFault(IoErr(), "Examine failed");
45 Printf("Waiting 5 seconds\n");
50 Printf("Calling SetFileDate\n");
51 if(SetFileDate("__TEST__", &stamp
)) {
52 if (ExamineFH(fh
, fib
))
54 curr
.dat_Stamp
= fib
->fib_Date
;
56 Printf("New file modification time: %s, %s, %s\n", day
, date
, time
);
59 PrintFault(IoErr(), "Examine failed");
62 PrintFault(IoErr(), "SetFileDate");
64 FreeDosObject(DOS_FIB
, fib
);
67 PrintFault(IoErr(), "Couldn't alloc FileInfoBlock");
70 DeleteFile("__TEST__");
73 PrintFault(IoErr(), "Couldn't create file");