arm-native/processor.resource: build for raspi target
[AROS.git] / test / dos / setfiledate.c
blob7652cedd12daa6793150d39dccc14a6864cdd915
1 /*
2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <dos/dos.h>
7 #include <proto/dos.h>
8 #include <dos/datetime.h>
10 int main(void)
12 struct DateTime curr;
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;
19 curr.dat_Flags = 0;
20 curr.dat_StrDay = day;
21 curr.dat_StrDate = date;
22 curr.dat_StrTime = time;
24 DateStamp(&curr.dat_Stamp);
25 DateToStr(&curr);
26 Printf("Current time: %s, %s, %s\n", day, date, time);
28 BPTR fh = Open("__TEST__", MODE_NEWFILE);
30 if (fh != BNULL)
32 struct FileInfoBlock *fib = AllocDosObject(DOS_FIB, NULL);
34 if (fib != NULL)
36 if (ExamineFH(fh, fib))
38 curr.dat_Stamp = fib->fib_Date;
39 DateToStr(&curr);
40 Printf("File modification time: %s, %s, %s\n", day, date, time);
42 else
43 PrintFault(IoErr(), "Examine failed");
45 Printf("Waiting 5 seconds\n");
46 Delay(5*50);
48 DateStamp(&stamp);
50 Printf("Calling SetFileDate\n");
51 if(SetFileDate("__TEST__", &stamp))
53 if (ExamineFH(fh, fib))
55 curr.dat_Stamp = fib->fib_Date;
56 DateToStr(&curr);
57 Printf("New file modification time: %s, %s, %s\n", day, date, time);
59 else
60 PrintFault(IoErr(), "Examine failed");
62 else
63 PrintFault(IoErr(), "SetFileDate");
65 FreeDosObject(DOS_FIB, fib);
67 else
68 PrintFault(IoErr(), "Couldn't alloc FileInfoBlock");
70 Close(fh);
71 DeleteFile("__TEST__");
73 else
74 PrintFault(IoErr(), "Couldn't create file");
76 return 0;