2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: CheckDate() - is a date valid ?
10 /*****************************************************************************
13 #include <utility/date.h>
14 #include <proto/utility.h>
16 AROS_LH1(ULONG
, CheckDate
,
19 AROS_LHA(struct ClockData
*, date
, A0
),
22 struct Library
*, UtilityBase
, 22, Utility
)
25 Examine the date described in the ClockData structure and
26 determine whether it is a valid date. In particular this
27 checks whether the ranges of the fields are within normal
30 This function does not check whether the wday field of the
31 ClockData structure is valid.
34 date - A ClockData structure desribing the date
38 If the date is valid, the number of seconds from midnight
39 1-Jan-1978 AD to the date, or 0 if the date is invalud.
42 The date 01-Jan-78 00:00:00 is actually returned as invalid.
44 This also assumes that the ClockDate refers to a date in the
45 Gregorian calendar. (60 sec/min, 60 min/hour, 24 hr/day,
51 Does not check whether the 29/2 is valid outside of a leap year.
54 Amiga2Date(), Date2Amiga()
57 Since all the values are unsigned, we don't have to check for < 0
58 in fields which range from 0 ... n.
61 29-10-95 digulla automatically created from
62 utility_lib.fd and clib/utility_protos.h
64 *****************************************************************************/
68 /* Note: 60!!! This is in case of any future leap seconds... */
78 /* XXX: When does the year become invalid? */
79 if( date
->year
< 1978 )
90 /* 30 days hath September, April, June and November */
99 /* And all the rest have 31 ... */
111 /* Except February with has 28, or 29 on a leap year,
112 should I check whether this is a leap year or not?
119 /* This also traps invalid month numbers */
122 } /* switch(date->month) */
124 return Date2Amiga(date
);