Latest release of ProDOS is 2.4.3

ProDOS 2.5 alpha 8 pre-release is available

ProDOS 8 Technical Note #28

ProDOS Dates -- 2000 and Beyond

Written by Dave Lyons (Septembet 1990)

This Technical Note explains how ProDOS year values range from zero to ninety-nine and represent the years 1940 through 2039.


The ProDOS date format uses sixteen bits: seven bits for the year, four for the month, and five for the day (see the ProDOS 8 Technical Reference Manual, page 71). Dates are represented in this format in the parameter blocks for ProDOS 8 MLI calls and in the directories of ProDOS volumes.

In seven bits, 128 different years could be represented, but the proper interpretation of those bits has never been defined clearly until now.

2000? I'll Be Dead By Then Anyway

It's only nine years, folks, and then things get weird. Is that ProDOS year 100 or ProDOS year 0? How do you compare two file-modification dates so it keeps working correctly?

Before you dismiss questions like this, consider just how sure you are that nobody will be using your software in nine years, or whether those few dedicated weirdos are going to call you up on January 1, 2000 to complain. There will be plenty of computer-related problems in 2000, so write your applications right today.

Some Choices

These two possible interpretations were considered and then rejected in favor of The Definition below.

  1. Valid years would be from 0 to 99, meaning 1900 to 1999, so ProDOS dates would just "expire" at the end of 1999. No fun.
  2. Valid years would be from 0 to 127, meaning 1900 to 2027. This is a little better, except that almost no existing software is prepared to deal with year values outside the 0-to-99 range.

So, you are left with...

The Definition

The following definition allows the same range of years that the Apple IIgs Control Panel CDA currently does:

  • A seven-bit ProDOS year value is in the range 0 to 99 (100 through 127 are invalid)
  • Year values from 40 to 99 represent 1940 through 1999
  • Year values from 0 to 39 represent 2000 through 2039
Note: Apple II and Apple IIgs System Software does not currently reflect this definition.

How to Compare Two Years

To compare two dates, you need to adjust the years to allow for the wrap-around effect between 39 and 40. A simple approach is to add 100 to any year less than 40 before doing the comparison, thus comparing two values in the range 40 to 139.


    CompareAB    lda YearB
                 cmp #40
                 bcs B_OK
                 adc #100    ;carry is clear
                 sta YearB

B_OK             lda YearA
                 cmp #40
                 bcs A_OK
                 adc #100    ;carry is clear
                 sta YearA

A_OK             cmp YearB
                 bcc A_is_earlier
                 ...

What About GS/OS Dates?

This definition affects how the GS/OS ProDOS File System Translator works internally, but it does not affect GS/OS applications. A year value under GS/OS is always a byte offset from 1900, giving a possible range of 1900 to 2155, regardless of the file system involved.

What Do You Do After 2039?

Apple is still working on it. Contact your neighborhood Apple Developer Technical Support office in 2030.

Further Reference


The Apple II Technical Notes have been converted to HTML by Aaron Heiss as a public service to the Apple II community, with permission by Apple Computer, Inc.

 

Any and all trademarks, registered and otherwise, are properties of their owners.