Custom Data Types

2000.06.12
author: Geoffrey M.

(c) 1999-2000 Ultratech Creations
wildfireZ is a trademark of Ultratech Creations

website: www.UltratechCreations.com

Distributed under the terms of the GNU Lesser General Public License.
See copyleft.txt for details.

 

 

 

Custom data types

PackedBoolean
HiresDateTime

 

 

 

packed booleans
If you have ever worked with flags, you ar familiar with packed booleans. Instead of using 8, 16, or 32 bits to represent a single boolean value, each bit stores a boolean state. The number of booleans is equal to the integer's width. Example: a byte (8-bits) contains 8 booleans. Accessing an individual boolean value is the same as reading/writing a bit. Boolean location numbers also correspond to bit location numbers, i.e. bit 12 = boolean #12. Remember, bits are numbered from RIGHT to LEFT regardless of processor architecture. A packedboolean8 is below.

bit location bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0
boolean value location 7 6 5 4 3 2 1 0

 

 

 

 

HiresDateTime
Hires_datetime is a custom data type that encodes extra info about a  user's time zone, the day of week, and has a time resolution of  2.328 picoseconds. Length is 12 bytes with the following bit assignments:

 

hires clock tick has a resolution of 2.328 picoseconds. Resolution must always be faster than the time to write a file to storage media. Otherwise, files can have identical timestamps.

bits 95 - 64
hires clock tick
(32 bytes)

 

bits 63 - 53 52 - 41 40 - 37 36 - 32
reserved
(11 bytes)
year
(12 bits)
month
(4 bits)
day
(5 bits)

  

bits 31 - 27 26 - 21 20 - 17 16 - 12 11 - 06 05 - 00
IDLOffset
(5 bits)
IDL Minutes Offset
(6 bits)
day of week
(4 bits)
hour
(5 bits)
minutes
(6 bits)
seconds
(6 bits)

 

 

All values are literal values for the current date/time. Dates are based on the Gregorian calendar. Valid ranges are:

value range
year 1980 - 4095
month 1 - 12
day 1 - 31
IDLOffset 0 - 24
IDLMinutesOffset 0 - 59
day of week 1 - 7
hour 0 - 23
minutes 0 - 59
seconds 0 - 59
tick 0 - 4294967296

 

day of week starts on sunday( = 1 ) and ends on saturday( = 7 ).

day of week value
sunday 1
monday 2
tuesday 3
wednesday 4
thursday 5
friday 6
saturday 7

 

 

time zone is based on International Date Line time. Functions for converting from GMT to/from IDL are included in the kernel.

time zone IDL zone
GMT +0 / -0 1
GMT +1 2
GMT +2 3
GMT +3 4
GMT +4 5
GMT +5 6
GMT +6 7
GMT +7 8
time zone IDL zone
GMT +8 9
GMT +9 10
GMT +10 11
GMT +11 12
GMT +12 / -12 13
GMT -11 14
GMT -10 15
GMT -9 16
time zone IDL zone
GMT -8 (pacific) 17
GMT -7 (mountain) 18
GMT -6 (central) 19
GMT -5 (eastern) 20
GMT -4 (atlantic) 21
GMT -3 22
GMT -2 23
GMT -1 24