home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d6xx
/
d634
/
apig.lha
/
APIG
/
apig33.lzh
/
util5.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1992-02-20
|
2KB
|
80 lines
/* Example of using Utility Library functions
Date Functions
*/
x = addlib("apig.library",0,-30,0)
call set_apig_globals()
clockdata = allocmem(14,MEMF_CLEAR)
/* ClockData Looks Like This
offset 0 UWORD sec
2 UWORD min
4 UWORD hour
6 UWORD mday
8 UWORD month
10 UWORD year
12 UWORD wday
size = 14bytes
*/
secsperday = 86000
daysperyear = 365
years = 14
/* plus 120 days */
daterelativeto1978 = (secsperday * daysperyear) * years + (secsperday * 120)
/* convert amiga date to something understandable */
call Amiga2Date(daterelativeto1978,clockdata) /* fills in clockdata */
sec = getvalue(clockdata,0,2,'n')
min = getvalue(clockdata,2,2,'n')
hour = getvalue(clockdata,4,2,'n')
mday = getvalue(clockdata,6,2,'n')
month = getvalue(clockdata,8,2,'n')
year = getvalue(clockdata,10,2,'n')
wday = getvalue(clockdata,12,2,'n')
say " sec =" sec
say " min =" min
say " hour =" hour
say " mday =" mday
say " month =" month
say " year =" year
say " wday =" wday
say " Date is Legal "
say " "
call setvalue(clockdata,6,2,'n',76) /* day of month set to 76 */
ill = CheckDate(clockdata) /* should return 0 for illegal date */
if ill = 0 then
say " Date is Illegal "
else
say " Date is Legal "
mday = setvalue(clockdata,6,2,'n',mday) /* set it back */
amigatime = Date2Amiga( clockdata ) /* convert clock to relative1978 */
say " "
say "Original Time = " daterelativeto1978 " got back " amigatime
call freemem(clockdata,14)
exit