pfs3.handler: Specify GlobalVec = -1, as per spec
[AROS.git] / test / date2amiga.c
blobc32a76493f22ca0db6f02569b86476f9e5f4cc9f
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, (long)days, (long)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, (long)days, (long)seconds, (long)secresult, (int)cd.year, (int)cd.month, (int)cd.mday);
60 days++;
61 seconds += 86400;
63 } while (days < 365 * 300); /* around 300 years */
65 CloseLibrary((struct Library *)UtilityBase);
68 return 0;