2 #include <utility/date.h>
3 #include <proto/exec.h>
5 #include <proto/utility.h>
8 struct UtilityBase
*UtilityBase
;
16 UtilityBase
= (struct UtilityBase
*)OpenLibrary("utility.library", 0);
19 dt
.dat_StrDate
= "31-dec-2000";
20 dt
.dat_Format
= FORMAT_DOS
;
27 printf("Verified date: \"%s\" days = %ld min = %ld tick = %ld\n",
29 (long)dt
.dat_Stamp
.ds_Days
,
30 (long)dt
.dat_Stamp
.ds_Minute
,
31 (long)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
);