home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Spezial
/
SPEZIAL2_97.zip
/
SPEZIAL2_97.iso
/
ANWEND
/
ONLINE
/
SREFPRC1
/
GMTTIME.SRF
< prev
next >
Wrap
Text File
|
1997-05-01
|
1KB
|
59 lines
/* ----------------------------------------------------------*/
/* Compute new GMT time in Sat, 12 Aug 1996 21:18:20 format
(or 123421 hh:mm:ss if dobase=1) */
/* if no args, use current date time, with no offset */
/* Otherwise:
first arg: add an offset (in fractions of a day)
date: base date in date('b') format
seconds: current seconds (i.e.; time('s')
dobase = if 1, return julian hh:mm:ss (don't do conversion of day)
If date or seconds is "", then use current date or seconds.
*/
/* ----------------------------------------------------------*/
sref_new_gmt:
parse arg fracadd,adate,asec,dobase
if fracadd="" then fracadd=0
if adate="" then adate=date('b')
if asec="" then asec=time('s')
wasd=digits() ;
numeric digits 12
sechr=60*60 ; secday=sechr*24
gmtadd=gmtoffset()
if datatype(gmtadd)<>"NUM" then
gmtadd=0
else
gmtadd=-gmtadd
gmttime=adate + ( (asec+gmtadd)/secday)
newtime=gmttime+fracadd
newdate=trunc(newtime)
newsec=newtime-newdate
if dobase=1 then
aday=newdate
else do
d2=dateconv(newdate,'b','n')
aday=LEFT(dateconv(newdate,'b','w'),3)
end
newsec=newsec*secday
nhr=trunc(newsec/sechr)
tmin=newsec-(nhr*sechr)
nmin=trunc(tmin/60)
nsec=trunc(tmin-(nmin*60))
issec=nhr':'nmin':'nsec
numeric digits wasd
if dobase=1 then
return aday ' ' issec
else
return aday ',' d2 ' ' issec