TOPIC
This article discusses ways developers can avoid causing Year 2000 problems in their code, including some issues relating specifically to Apple's OPENSTEP and WebObjects frameworks and API's. This article does
not
discuss the Year 2000 compliance status of any Apple product; for Y2K compliance information, see the Apple Year 2000 main page at
http://www.apple.com/
about/year2000 .
DISCUSSION Working with Dates in WebObjects A detailed overview of date handling in WebObjects is now available for download in PDF format . Use Consistent Date Handling Consistency in date hanlding makes maintaining and fixing date-handling code easier. Apple recommends that you always use the Foundation date and time API's when you need to write date-handling code for OPENSTEP or WebObjects. Don't Divide By an NSTimeInterval Value
Dates are represented in the Foundation framework with
NSDate
and
NSCalendarDate
objects and
NSTimeInterval
values. An
NSTimeInterval
object is essentially a C-language double (
NSTimeInterval
can represent intervals of approximately 10,000 years with sub-millisecond accuracy).
NSDate
and
NSCalendarDate
store the date that they represent with an
NSTimeInterval
which represents the time delta in seconds from the Foundation reference date (00:00:00 Greenwich Mean Time January 1, 2000). Since the internal time representation will transition across zero at the reference date, there will be a brief instant (on the order of microseconds in length) during which an
NSDate
object created to represent the current time will have an
NSTimeInterval
of zero. An
NSTimeInterval
of zero has no special significance to
NSDate
or
NSCalendarDate
, but applications that use the
NSTimeInterval
of a date object in division should protect against division by zero. This is unlikely to occur in real-world applications.
|
Document Information | |
Product Area: | WebObjects |
Category: | Objective C; WebObjects 3.0 and 3.1; WebObjects 3.5.1; WebObjects 4 |
Sub Category: | Development |
Copyright © 2000 Apple Computer, Inc. All rights reserved.