2 Copyright © 1995-2015, 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
))
53 if (ExamineFH(fh
, fib
))
55 curr
.dat_Stamp
= fib
->fib_Date
;
57 Printf("New file modification time: %s, %s, %s\n", day
, date
, time
);
60 PrintFault(IoErr(), "Examine failed");
63 PrintFault(IoErr(), "SetFileDate");
65 FreeDosObject(DOS_FIB
, fib
);
68 PrintFault(IoErr(), "Couldn't alloc FileInfoBlock");
71 DeleteFile("__TEST__");
74 PrintFault(IoErr(), "Couldn't create file");