Re: File Date/Time

 BBS: Inland Empire Archive
Date: 03-31-93 (06:46)             Number: 349
From: DICK DENNISON                Refer#: NONE
  To: MICHAEL BAILEY                Recvd: NO  
Subj: Re: File Date/Time             Conf: (2) Quik_Bas
'>>> Start of page 2 of dt.bas

'bits 00h-04h = day (1-31)
'bits 05h-08h = month (1-12)
'bits 09h-0Fh = year (relative to 1980)

day% = parm% AND 31        'get bits 0-4
dayz$ = LTRIM$(STR$(day%))
IF LEN(dayz$) = 1 THEN dayz$ = "0" + (dayz$)  'Parse and add leading 0
' if needed
parm% = parm% \ 32         'shift left 5
Month% = parm% AND 15      'get bits 5-8
parm% = parm% \ 16         'shift left 4
year% = (parm% AND 255) + 80    'get bits 9-15 and add to 1980
moddate$ = dayz$ + mon$(Month%) + LTRIM$(STR$(year%))  'Format is
' 20-Oct-90

fixdate$ = "  " + moddate$ + "  "

END FUNCTION

FUNCTION fixtime$ (parm%)
'Date and time are in packed format - these are the breakouts
'bits 00h-04h = 2 second incs (0-29)
'bits 05h-0Ah = minutes (0-59)
'bits 0Bh-0Fh = hours (0-23)

temp& = parm%
IF parm% < 0 THEN temp& = temp& + 65536  'Check for sign (+ -)
secs% = (temp& AND 31) * 2  'get bits 0-4 and multiply by 2
temp& = temp& \ 32          'shift right 5
mins% = temp& AND 63        'get bits 5-10
temp& = temp& \ 64          'shift right 6
hours% = temp& AND 31       'get bits 11-15
sec$ = LTRIM$(STR$(secs%))
IF LEN(sec$) = 1 THEN sec$ = "0" + sec$    'Parse and add leading 0's
min$ = LTRIM$(STR$(mins%))
IF LEN(min$) = 1 THEN min$ = "0" + min$    'if needed
hour$ = LTRIM$(STR$(hours%))
IF LEN(hour$) = 1 THEN hour$ = "0" + hour$

modtime$ = hour$ + ":" + min$ + ":" + sec$  'Format is 01:30:46
fixtime$ = modtime$

END FUNCTION

FUNCTION getdate&
gdatetop:
PRINT "New Month (01-12): ";
mo% = GetNum%(2, 1, 12)
IF mo% = 0 THEN
   getdate& = fi.datef + 0&
   PRINT "Use Old Date"
   EXIT FUNCTION
END IF
PRINT "New Date (01-31): ";
da% = GetNum%(2, 1, 31)
PRINT "New Year : 19";
yr% = GetNum%(2, 0, 99) - 80
PRINT "          New File Date : "; LTRIM$(STR$(mo%)); "/"; _
 LTRIM$(STR$(da%)); "/"; LTRIM$(STR$(yr% + 80))

'datef%   'bits 0-4h=day(1-31),5-8h=month(1-12),9-Fh=year-1980
         ' +                      , * 32          ,*512
datef& = yr% * 512& + mo% * 32& + da%

getdate& = datef&
END FUNCTION

FUNCTION getdir$

CLS
SHARED dta AS STRING * 44
'SHARED namef$
DIM regs AS RegTypeX
DIM array(125) AS STRING
   regs.ax = &H1A00                       'DOS service to set DTA
   regs.ds = VARSEG(dta)
   regs.dx = VARPTR(dta)
   CALL INTERRUPTX(&H21, regs, regs)
temp$ = "*.*" + CHR$(0)
IF LEN(COMMAND$) THEN temp$ = COMMAND$ + CHR$(0)
  findnext% = 0
   FOR p% = 0 TO 124
   'BEEP
       IF findnext% THEN
           regs.ax = &H4F00
       ELSE
           regs.ax = &H4E00 'find first

       END IF
       regs.cx = 0             'normal attributes
       regs.ds = VARSEG(temp$)
       regs.dx = SADD(temp$)
       CALL INTERRUPTX(&H21, regs, regs)
       'PRINT regs.ax

'>>> Continued on page 3.

--- VP [DOS] V4.09e
 * Origin: The MailMan  (914)374-3903 NY Quick Share Pt #7 *HST (1:272/34)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET