08-28-2006 03:00 PM
08-28-2006 03:19 PM
I've always kinda wondered that too. Here's an article on microsoft.com that discusses the 1900 date system vs. the 1904 date system on computers. Apparently it's not just LabVIEW that deals with the 1/1/1904 date.
-D
08-28-2006 03:47 PM
Nice article, Darren- I think this line is particularly important for the LabVIEW case:
"Because of the design of early Macintosh computers, dates before January 1, 1904 were not supported..."
Since early versions of LabVIEW were designed on early Macintosh computers I'm guessing that the 1904 date is just a holdover from that era. I know there used to be a similar Mac-related holdover in the LabVIEW binary file i/o VIs- LabVIEW used to write binary files using Big Endian representation (unlike most Windows apps which use Little Endian).
08-28-2006 04:03 PM
08-29-2006 05:08 PM
Here's the deal with January 1, 1904. Most (all?) operating systems store time as the number of seconds ( or microseconds, etc.) since a certain time. This time is call the epoch. The number of seconds that the Mac could store covered about 130 years. The programmers wanted the system to be able to cover the birthdays of most users, so the epoch needed to start in the early 20th century. So why not start at January 1, 1900?
The Macintosh designers needed to squish a lot of code into a very small amount of ROM/RAM. They were looking for any kind of tweak that could save them some room. The code to turn the number of seconds since the epoch into a date (like March 29, 1973) needs to know how many days there are in a year. Which means you need code to determine if a year is a leap year.
A year is a leap year if it is a multiple of 4 unless it is a multiple of 100 except if it is also a multiple of 400. So, 1900 wasn't a leap year (multiple of 100), but 2000 was (multiple of 100, but also a multiple of 400). By avoiding the year 1900, the Mac designers never had to worry about the 100/400 part of the leap year rule (because the 130 year span would only cover 2000 which was a leap year). If the year was a multiple of 4, it was a leap year.
So why not 1901 or 1902 or 1903? By starting with a leap year they didn't need an 'offset', just another way to save a little bit of space.
And since LabVIEW started on the Mac, it inherited some of those quirks.
Today the Mac doesn't use the 1904 epoch, but LabVIEW still does. NI needs a cross-platform epoch and a standard doesn't exist so January 1, 1904 is as good as any.
Pat
08-29-2006 05:22 PM - edited 08-29-2006 05:22 PM
Message Edited by Lavezza on 08-29-2006 03:22 PM
08-30-2006 01:31 AM
08-30-2006 01:54 AM
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
08-30-2006 09:03 AM
08-30-2006 09:27 AM