![]() |
LongDateRec |
Header: DateTimeUtils.h |
union LongDateRec { union { SInt16 era; SInt16 year; SInt16 month; SInt16 day; SInt16 hour; SInt16 minute; SInt16 second; SInt16 dayOfWeek; SInt16 dayOfYear; SInt16 weekOfYear; SInt16 pm; SInt16 res1; SInt16 res2; SInt16 res3; } ld; SInt16 list[14]; union { SInt16 eraAlt; DateTimeRec oldDate; } od; };
The era, where 0 represents A.D., and 1 represents B.C.
The year, ranging from 30,081 B.C. to 29,940 A.D. Values outside this range produce unpredictable results in all fields of the record. Note that to indicate the year 1984, this field would store the integer 1984, not just 84. This field accepts input of 0 or negative values, but these values return the positive result of the value plus one for the year. For example, a year value of 0 returns 1, and a year value of 1993 returns 1994. Other fields are unaffected.
The month of the year, where 1 represents January, and 12 represents December. When you use the LongSecondsToDate and LongDateToSeconds functions, month values greater than 12 cause a wraparound to a future year and month. A value of 0 in this field returns the 12th month of the previous year. For example, a month value of 0 and a year value of 1993 return 12 and 1992, respectively. A negative value in this field has the effect of subtracting that number from the first month of the given year. For example, a month value of 2 and a year value of 1993 return 10 and 1992, respectively.
In addition to the date-time record, system software provides the long date-time record, which extends the date-time record format by adding several more fields. This format lets you use dates and times with a much longer span (30,000 B.C. to 30,000 A.D.). In addition, the long date-time record allows conversions to different calendar systems, such as a lunar calendar.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)