Initial idea was to use two time instance variables. One to store the
start time, one to store the lap time.
Get the difference between the two and you have your lap time.
However, I can't see any simple way of comparing the times (down to
1/100th) as PB doesn't seem to cater for that sort of thing.
Requires a mess of splitting it into it's component bits (min, sec,
fraction) and subtracting each one.
The alternative is to set up a timer object and trigger that on a
recurring basis 1/100th of a second and increment a set of variables
for min, sec and fractions.
This tended to do it's own thing and ran slower than real time.
Would be nice if there was a simple-ish way to fire a timer that
counted from 0 and reset each lap.
Ideally for display purposes a static text that has the time running
would be useful too.
Thanks in advance.
time lt_start, lt_end
secondsafter(lt_start, lt_end)*1000 + long(string(lt_end,'fff')) -
long(string(lt_start,'fff'))
You could:
- write your own (this sounds "funnest" to me ... shades of Steve
Jobs' grammarian <g>... but maybe that's just me)
- steal something already written (e.g.
https://pfc.codexchange.sybase.com/source/browse/pfc/pfc10/pfcapsrv/pfc_n_cst_datetime.sru?revision=1.1&view=markup)
- create parallel values from the CPU() function, which can easily be
subtracted, but then you'd have to write something to make it human
readable, which may look something like:
function of_millisecondstotime (long al_Milliseconds) returns string
long ll_Milliseconds, ll_Seconds, ll_Minutes, ll_Hours, ll_Days
string ls_Output
ll_Milliseconds = Mod (al_Milliseconds, 1000)
ll_Seconds = (al_Milliseconds - ll_Milliseconds)/1000
IF ll_Seconds > 0 THEN
ll_Minutes = (ll_Seconds - Mod (ll_Seconds, 60))/60
IF ll_Minutes > 0 THEN
ll_Seconds = Mod (ll_Seconds, 60)
ll_Hours = (ll_Minutes - Mod (ll_Minutes, 60))/60
IF ll_Hours > 0 THEN
ll_Minutes = Mod (ll_Minutes, 60)
ll_Days = (ll_Hours - Mod (ll_Hours, 24)) / 24
ll_Hours = Mod (ll_Hours, 24)
END IF
END IF
END IF
IF ll_Days > 0 THEN ls_Output += String (ll_Days) + " day(s), "
IF (ll_Hours > 0) OR Len (ls_Output) > 0 THEN ls_Output += String
(ll_Hours) + ":"
IF (ll_Minutes > 0) OR Len (ls_Output) > 0 THEN ls_Output += String
(ll_Minutes, "00") + ":"
ls_Output += String (ll_Seconds, "00") + "." + String
(ll_Milliseconds, "000")
RETURN ls_Output
Good luck,
Terry and Sequel the techno-kitten
*********************************
Build your vocabulary while feeding the hungry
http://www.freerice.com
*********************************
Newsgroup User Manual
=====================
TeamSybase <> Sybase employee
Forums = Peer-to-peer
Forums <> Communication with Sybase
IsNull (AnswerTo (Posting)) can return TRUE
Forums.Moderated = TRUE, so behave or be deleted
*********************************
Sequel's Sandbox: http://www.techno-kitten.com
Home of PBL Peeper, a free PowerBuilder Developer's Toolkit.
Version 4.0.4 now available at the Sandbox
PB Futures updated June 25/2008
See the PB Troubleshooting & Migration Guides at the Sandbox
^ ^
o o
=*=
http://www.topwizprogramming.com/freecode_ping.html
It uses QueryPerformanceCounter Win API function to measure elapsed time
down to 6 decimal places.
"geoffwnz" <geoff....@customs.govt.nz> wrote in message
news:7b792824-9704-42d7...@a19g2000pra.googlegroups.com...
FYI, it's for motorsport lap timing, rather than down at the
pool. :-) Although with the state of some of the rugged PDA's these
days, that's not beyond possibility either.
"geoffwnz" <geoff....@customs.govt.nz> wrote in message
news:72bb3a03-5ead-4365...@g17g2000prg.googlegroups.com...
On Sep 23, 8:38 am, "Roland Smith [TeamSybase]"
<rsmith_at_trusthss_dot_com> wrote:
> If you decide to try a PDA, take a look at PocketBuilder. You could have a
> SQL Anywhere database local to the device and then when you bring it back to
> your office, upload the database transactions.
>
> "geoffwnz" <geoff.war...@customs.govt.nz> wrote in message