delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/02/02/14:32:24

Date: Wed, 2 Feb 94 13:33:19 EST
From: peprbv AT cfa0 DOT harvard DOT edu (Bob Babcock)
To: fb33 AT rummelplatz DOT uni-mannheim DOT de
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: finfirst(..), findnext(..)
Reply-To: babcock AT cfa DOT harvard DOT edu

> Turbo-Pascal includes the function Unpacktime() to interprete the values 
> of ff_ftime and ff_fdate. Is there a similiar function in djgcc?

Date and time are packed into the minimum number of bits necessary to hold
the possible range of values in the order which makes sorting
straightforward.  (It's much easier to remember it this way and derive the
result when you need it than to remember the details.)  So, in the date
field, the high order 7 bits hold the number of years since 1980, the next 4
bits hold the month and the last 5 hold the day.  In the time field, the high
order 5 bits hold the hour (24 hour clock), the next 6 bits hold the minute
and the last 5 hold twice the number of seconds.  Extracting the various
fields is a simple matter of masking and shifting.  For example, the minutes
field would be (ff_time>>5)&0x3f.

> Another problem is, that those functions are really slow.

I call the underlying DOS functions directly (because the code predates
compilers having findfirst/findnext functions) and don't find this to be
slow.  Could you be tight on memory and paging between calls?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019