make fat.handler build again with debug enabled
[tangerine.git] / test / amiga2date.c
blob8e755714341e0e43b92686e003fd981bf0535c91
1 #include <dos/dos.h>
2 #include <utility/date.h>
3 #include <proto/exec.h>
4 #include <proto/dos.h>
5 #include <proto/utility.h>
6 #include <stdio.h>
8 struct UtilityBase *UtilityBase;
9 struct DateTime dt;
10 struct ClockData cd;
12 char s[100];
14 int main(void)
16 UtilityBase = (struct UtilityBase *)OpenLibrary("utility.library", 0);
17 if (UtilityBase)
19 dt.dat_StrDate = "31-dec-2000";
20 dt.dat_Format = FORMAT_DOS;
22 if (StrToDate(&dt))
24 dt.dat_StrDate = s;
25 if (DateToStr(&dt))
27 printf("Verified date: \"%s\" days = %ld min = %ld tick = %ld\n",
29 dt.dat_Stamp.ds_Days,
30 dt.dat_Stamp.ds_Minute,
31 dt.dat_Stamp.ds_Tick);
33 Amiga2Date(dt.dat_Stamp.ds_Days * 60 * 60 * 24 +
34 dt.dat_Stamp.ds_Minute * 60 +
35 dt.dat_Stamp.ds_Tick / 50, &cd);
37 printf("\nAmiga2Date says:\n\n");
38 printf("sec = %d\n", cd.sec);
39 printf("min = %d\n", cd.min);
40 printf("hour = %d\n", cd.hour);
41 printf("mday = %d\n", cd.mday);
42 printf("month = %d\n", cd.month);
43 printf("year = %d\n", cd.year);
44 printf("wday = %d\n", cd.wday);
46 printf("\n-------- One day later -----------\n\n");
48 Amiga2Date((dt.dat_Stamp.ds_Days + 1) * 60 * 60 * 24 +
49 dt.dat_Stamp.ds_Minute * 60 +
50 dt.dat_Stamp.ds_Tick / 50, &cd);
52 printf("\nAmiga2Date says:\n\n");
53 printf("sec = %d\n", cd.sec);
54 printf("min = %d\n", cd.min);
55 printf("hour = %d\n", cd.hour);
56 printf("mday = %d\n", cd.mday);
57 printf("month = %d\n", cd.month);
58 printf("year = %d\n", cd.year);
59 printf("wday = %d\n", cd.wday);
62 else puts("DateToStr failed!");
64 else puts("StrToDate failed!");
66 CloseLibrary((struct Library *)UtilityBase);
69 return 0;