[comp.sys.handhelds] time formats for HP28s

jrl@images1.Waterloo.NCR.COM (john Latala) (07/24/90)

I was working on a program that did time/date manipulations. I ended up
with a list of dates and wanted to sort them. This is where the problem
started. 

I'm using a HP28 variations of a number of time routines that I used on
my HP41. I modified the routines to follow the HP41 date/time format.
Times are in the format HH.MMSSTT and dates are in the format MM.DDYYYY.

Sorting dates in the MM.DDYYYY format doesn't work! January 1, 1991
(01.011991) is before July 1, 1990 (07.011990)!

I was thinking about converting to something like YYYY.MMDD or even
YYYYMMDD.

After a bit more poking around I thought maybe going to a binary version
might be a litte neater, something like #YYYYMMDDhhmmssttd. This format
doesn't look to bad because I can get a complete date/time into one
number, which is kind of a nice idea.

Any other formats that may be more suitable to manipulation?

In planning for when it happens how does the HP48 store/handle
dates/times?

My current routines actually keep the time as GMT. I then have a
variable called 'TZ' that stores the number of (1/8192)'ths of a second
that the local time zone is shifted from GMT. 

My date/time routines get the current tick count, add the 'TZ' variable
and convert the result to either a date or a time. 

Do any other calculators besides the HP's offer this kind of date/time
manipulation?
--
john.Latala@Waterloo.NCR.COM

neal@druhi.att.com (XGPB30000-McBurnettND(DR9225)289) (07/26/90)

In article <920@ncrwat.Waterloo.NCR.COM>, jrl@images1.Waterloo.NCR.COM
(john Latala) writes:
|> Times are in the format HH.MMSSTT and dates are in the format MM.DDYYYY.
|> 
|> Sorting dates in the MM.DDYYYY format doesn't work! January 1, 1991
|> (01.011991) is before July 1, 1990 (07.011990)!
|> 
|> I was thinking about converting to something like YYYY.MMDD or even
|> YYYYMMDD.
|> 
|> After a bit more poking around I thought maybe going to a binary version
|> might be a litte neater, something like #YYYYMMDDhhmmssttd. This format
|> doesn't look to bad because I can get a complete date/time into one
|> number, which is kind of a nice idea.
|> 
|> In planning for when it happens how does the HP48 store/handle
|> dates/times?

Unfortunately, the HP48 also uses a date format which can't be sorted,
like the HP41, and even HP12.

I want the same characteristics you want:
	Both date and time in one object
	"<" operator works
I also want negative years to work (with the "historical" semantics in which
there is no year zero), and I want the precision to work down to fractions
of seconds.  [+-]YYYY.MMDDHHMMSS works pretty well except that some trailing
precision is lost.  The binary suggestion is interesting, but it is
more error-prone and tedious to enter (e.g. if you enter the wrong number
of digits).  I think your approach of using GMT is a good one, since problems
always come up with daylight savings time.

Another approach is to enter numbers via one scheme and store them in another,
e.g. enter as a complex (date, time) value and store as julian date (which
has precision down to around a second over the last 6000 years, as I recall.)

-Neal McBurnett // AT&T Bell Labs, Denver // neal@druhi.ATT.COM, att!druhi!neal