|Home » Articles » My articles|
GEDKeeper has many really nice coding stuffs. Let me reveal one such thing for you: Unified Day Number (UDN).
Every time you specify a date in GEDKeeper, for example, 'November 2, 2016', 'after July 15, 1976', 'October unknown day, 1900' and so on, UDN comes into play. Unified day number is a beast GEDKeeper uses under the hood when it's necessary to store and process dates.
Unified day number framework is based on Julian day and it is a way GEDKeeper stores continuous count of days since the beginning of the Julian Period. Just like as JDN, UDN is an integer value with some additional optional properties, like: "The date with unknown year", "Approximate date", etc. Set of such properties and the UDN value itself form one double word value (32 bits). Why do they fit one double word value? Because normal Julian day number is based on the Julian Period with size of 7980 years. The next Julian Period begins in the year 3268 AD. Thus, JDN upper limit is 0x2c7986 (0b1011000111100110000110). We need no more than 22 bits available for JDN. C#'s `uint` type provides us 32 bits. We couldn't resist the temptation to use the rest ten bits! Now six highest bits (26th-31th) are properties of the date, and the first twenty-six (0-25) bits are UDN (JDN) value.
Currently GEDKeeper's UDN framework supports the following types of dates:
†A "date before" and a "date after" can't be approximate and vice versa.
‡A "date between" must have valid year number.
One of the most attractive thing I should mention about UDN is ability to order such dates. For example, GEDKeeper GUI shows 'near November 2016' right after the 'Before November 2, 2016'. That's how GEDKeeper orders UDNs:
|Views: 102 | Comments: 1 ||
|Total comments: 1|