TIP: Click on subject to list as thread! ANSI
echo: quik_bas
to: All
from: Hans Andersson
date: 2003-06-27 16:50:40
subject: `timer object`

'timer.inc
'NOTE! DEF FN must be last include
 
TYPE TimerT
  started AS SINGLE
  waitsecs AS SINGLE
  stoptime AS SINGLE
END TYPE
 
DECLARE SUB TimerStart (Self AS TimerT, Secs!)
DECLARE FUNCTION TimeUsed! (Self AS TimerT)
DECLARE FUNCTION TimeRemain! (Self AS TimerT)
 
CONST SECSINDAYS = 864000
 
DEF FNStartClock! (Secs!)
FNStartClock! = TIMER + Secs!
END DEF
 
DEF FNClockStop% (Tstop!)
tleft! = Tstop! - TIMER
IF tleft! > 360000 THEN
   tleft! = Tstop! - (TIMER + SECSINDAYS)
END IF
FNClockStop% = (tleft! <= 0!)
END DEF
 
DEF FNClockRemain& (Tstop!)
tleft! = Tstop! - TIMER
IF tleft! > 360000 THEN
   tleft! = Tstop! - (TIMER + SECSINDAYS)
END IF
FNClockRemain& = tleft!
END DEF
 
'Cut here ............................................................
'REM timer.bas "object"
 
'$INCLUDE: 'timer.inc'
 
 
FUNCTION TimeRemain! (Self AS TimerT)
DIM Now AS SINGLE
 
Now = TIMER
IF Now < Self.started THEN
   Now = Now + SECSINDAYS
END IF
 
TimeRemain! = Self.stoptime - Now
 
END FUNCTION
 
SUB TimerStart (Self AS TimerT, TimeOutSecs!)
 
Self.started = TIMER
Self.stoptime = Self.started + TimeOutSecs!
Self.waitsecs = TimeOutSecs!
 
END SUB
 
FUNCTION TimeUsed! (Self AS TimerT)
DIM Secs AS SINGLE
 
Secs = TimeRemain!(Self)
TimeUsed! = Self.waitsecs - Secs
 
END FUNCTION
 


--- Maximus/2 3.01
* Origin: TankBaren, +46-8-4467316 (2:201/209)
SEEN-BY: 633/267 270
@PATH: 201/505 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.