Attempt to fix creation of boot floppy with new nightly scripts.
[tangerine.git] / test / date2amiga.c
blob4a400e8bb60e8e3b058e438b9bef0d304964e574
1 #include <dos/datetime.h>
2 #include <dos/dos.h>
3 #include <proto/exec.h>
4 #include <proto/dos.h>
5 #include <proto/utility.h>
6 #include <utility/date.h>
7 #include <string.h>
8 #include <stdio.h>
10 struct UtilityBase *UtilityBase;
11 struct DateTime dt;
12 struct DateStamp ds;
13 struct ClockData cd;
15 char s[100];
17 LONG days = 0;
18 ULONG seconds = 0;
19 ULONG secresult;
21 int main(void)
23 if (!(UtilityBase = (struct UtilityBase *)OpenLibrary("utility.library", 36)))
25 printf("Can't open utility.library!\n");
27 else
31 dt.dat_Stamp.ds_Days = days;
32 dt.dat_Format = FORMAT_DOS;
33 dt.dat_StrDate = s;
35 DateToStr(&dt);
37 dt.dat_Stamp.ds_Days = -1;
38 StrToDate(&dt);
40 //printf("date \"%s\" day = %ld\n", s, days);
42 if (dt.dat_Stamp.ds_Days != days)
44 printf("StrToDate showed bad results for date \"%s\" (day #%ld). "
45 "StrToDate thought it was day #%ld\n", s, days, dt.dat_Stamp.ds_Days);
47 else
49 Amiga2Date(seconds, &cd);
50 if ((secresult = Date2Amiga(&cd)) != seconds)
52 printf("Date2Amiga gave wrong values for date \"%s\" (day #%ld)"
53 " (secs %ld) -> wrong secs is %ld"
54 " --> clockdate: year = %d month = %d day = %d\n"
55 , s, days, seconds, secresult, cd.year, cd.month, cd.mday);
60 days++;
61 seconds += 86400;
63 } while (days < 365 * 300); /* around 300 years */
65 CloseLibrary((struct Library *)UtilityBase);
68 return 0;