Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #1940 > unrolled thread

How to check if 1400 ms have passed?

Started byD.J.W. van Kooten <public@ic2remove.this.com>
First post2011-09-04 23:25 +0200
Last post2011-09-06 08:15 +0000
Articles 20 on this page of 22 — 9 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  How to check if 1400 ms have passed? D.J.W. van Kooten <public@ic2remove.this.com> - 2011-09-04 23:25 +0200
    Re: How to check if 1400 ms have passed? dlzc <dlzc1@cox.net> - 2011-09-04 14:50 -0700
      Re: How to check if 1400 ms have passed? D.J.W. van Kooten <public@ic2remove.this.com> - 2011-09-05 08:51 +0200
        Re: How to check if 1400 ms have passed? dlzc <dlzc1@cox.net> - 2011-09-05 12:05 -0700
          Re: How to check if 1400 ms have passed? "Willie Moore" <williem@wmconsulting.com> - 2011-09-05 15:10 -0500
            Re: How to check if 1400 ms have passed? D.J.W. van Kooten <public@ic2remove.this.com> - 2011-09-06 11:13 +0200
        Re: How to check if 1400 ms have passed? malcolm gray <malcolm.gray@ntlworld.com> - 2011-09-06 11:32 +0100
    Re: How to check if 1400 ms have passed? "Bernhard Mayer" <Idonotexisthere@nowhere.com> - 2011-09-05 07:32 +0200
      Re: How to check if 1400 ms have passed? D.J.W. van Kooten <public@ic2remove.this.com> - 2011-09-05 08:48 +0200
    Re: How to check if 1400 ms have passed? Karl Wochele <kw@e©os-system.de> - 2011-09-05 08:49 +0200
      Re: How to check if 1400 ms have passed? D.J.W. van Kooten <public@ic2remove.this.com> - 2011-09-05 13:16 +0200
        Re: How to check if 1400 ms have passed? Karl Wochele <kw@e©os-system.de> - 2011-09-05 13:42 +0200
          Re: How to check if 1400 ms have passed? D.J.W. van Kooten <public@ic2remove.this.com> - 2011-09-05 15:14 +0200
            Re: How to check if 1400 ms have passed? Karl Wochele <kw@e©os-system.de> - 2011-09-05 15:27 +0200
              Re: How to check if 1400 ms have passed? D.J.W. van Kooten <public@ic2remove.this.com> - 2011-09-06 10:57 +0200
    Re: How to check if 1400 ms have passed? E®!k \\/!$$E® <nospam@nospam.url> - 2011-09-06 09:46 +0200
      Re: How to check if 1400 ms have passed? E®!k \\/!$$E® <nospam@nospam.url> - 2011-09-06 10:18 +0200
        Re: How to check if 1400 ms have passed? Karl Wochele <kw@e©os-system.de> - 2011-09-06 10:25 +0200
          Re: How to check if 1400 ms have passed? E®!k \\/!$$E® <nospam@nospam.url> - 2011-09-06 10:30 +0200
      Re: How to check if 1400 ms have passed? Karl Faller <k.faller_withoutthat_@onlinehome.de> - 2011-09-06 10:29 +0200
        Re: How to check if 1400 ms have passed? E®!k \\/!$$E® <nospam@nospam.url> - 2011-09-06 10:47 +0200
    Re: How to check if 1400 ms have passed? "Dirk (Belgium)" <dirk.dot.herijgers@pbprojects.dot.be> - 2011-09-06 08:15 +0000

Page 1 of 2  [1] 2  Next page →


#1940 — How to check if 1400 ms have passed?

FromD.J.W. van Kooten <public@ic2remove.this.com>
Date2011-09-04 23:25 +0200
SubjectHow to check if 1400 ms have passed?
Message-ID<1qq76794pr6o8jqfmcepteronclarh2kkd@4ax.com>
In my bBrowser class, Dispatch, I have some code allowing the user to
autoseek while typing. For that the ideal waiting time until the
string is reset (e.g.  because someone made a mistake and want to
start over) is 1400 ms. I used:

nNow:=LONGINT(GetTickCountLow()) IF(nNow-SELF:nLastKeyPressTime>1400)
	SELF:cSeek:=""
ENDIF

But I read (after an error of course) that this gives a numeric
overflow error when Windows runs longer than 5 days (not very
elegantly handled I think)....


For now I replaced it with:

nNow:=LONGINT(Secs(Time())) 	
which means the waiting time is either 1 seconds (just too short I
think) or 2 seconds, too long. But Secs() does not return
milliseconds.

It's not really a big deal but does anyone know which function is
actually better suited to measure 1400 ms seconds bypassed without
giving runtime errors?

Dick

[toc] | [next] | [standalone]


#1941

Fromdlzc <dlzc1@cox.net>
Date2011-09-04 14:50 -0700
Message-ID<b962dac3-7680-48b8-8167-1af7e77c7ecb@s35g2000prm.googlegroups.com>
In reply to#1940
Dear D.J.W. van Kooten:

On Sep 4, 2:25 pm, D.J.W. van Kooten <pub...@ic2remove.this.com>
wrote:
> In my bBrowser class, Dispatch, I have some code
> allowing the user to autoseek while typing. For
> that the ideal waiting time until the string is
> reset (e.g.  because someone made a mistake and
> want to start over) is 1400 ms. I used:
>
> nNow:=LONGINT(GetTickCountLow()) IF(nNow-SELF:nLastKeyPressTime>1400)
>         SELF:cSeek:=""
> ENDIF
>
> But I read (after an error of course) that this
> gives a numeric overflow error when Windows runs
> longer than 5 days (not very elegantly handled I
> think)....
>
...

How about moving the stakes forward on string reset?
> nNow:=LONGINT(GetTickCountLow()) IF(nNow-SELF:nLastKeyPressTime>1400)
>         SELF:cSeek:=""
          SELF:nLastKeyPressTime := nNow
> ENDIF

David A. Smith

[toc] | [prev] | [next] | [standalone]


#1945

FromD.J.W. van Kooten <public@ic2remove.this.com>
Date2011-09-05 08:51 +0200
Message-ID<h7s8671pi9hik94vu77mad3cijdsjcgmag@4ax.com>
In reply to#1941
On Sun, 4 Sep 2011 14:50:56 -0700 (PDT), dlzc <dlzc1@cox.net> wrote:

Hello David,

>How about moving the stakes forward on string reset?
>> nNow:=LONGINT(GetTickCountLow()) IF(nNow-SELF:nLastKeyPressTime>1400)
>>         SELF:cSeek:=""
>          SELF:nLastKeyPressTime := nNow
>> ENDIF
>
I am not sure what you mean?

Basically, GetTickCountLow is an unusable function as even the help
says it will give a run time error (numeric overflow) when the server
is up >5 days which is not that exceptional;...So I need an
alternative to count milliseconds; the place in the code is ok.

Dick

[toc] | [prev] | [next] | [standalone]


#1950

Fromdlzc <dlzc1@cox.net>
Date2011-09-05 12:05 -0700
Message-ID<46d45baf-0e73-4e47-bc84-ff38543fa4f9@b34g2000prf.googlegroups.com>
In reply to#1945
On Sep 4, 11:51 pm, D.J.W. van Kooten <pub...@ic2remove.this.com>
wrote:
> On Sun, 4 Sep 2011 14:50:56 -0700 (PDT),dlzc<dl...@cox.net> wrote:
>
> Hello David,
>
> >How about moving the stakes forward on string reset?
> >> nNow:=LONGINT(GetTickCountLow()) IF(nNow-SELF:nLastKeyPressTime>1400)
> >>         SELF:cSeek:=""
> >          SELF:nLastKeyPressTime := nNow
> >> ENDIF
>
> I am not sure what you mean?

I had assumed the difference has exceed range for a long integer.

> Basically, GetTickCountLow is an unusable function as
> even the help says it will give a run time error
> (numeric overflow) when the server is up >5 days
> which is not that exceptional;...

Can you reinitialize the "GetTickCount" function in the IF / ENDIF
loop?

David A. Smith

[toc] | [prev] | [next] | [standalone]


#1951

From"Willie Moore" <williem@wmconsulting.com>
Date2011-09-05 15:10 -0500
Message-ID<j43aaj$veg$1@speranza.aioe.org>
In reply to#1950
David,

That is what I was thinking. If a user has not hit a key in 5 days, it 
shouldn’t hurt to reset it. I have not used bBrowser in this sort of loop 
but I have done it in GridPro.

Regards,
Willie

[toc] | [prev] | [next] | [standalone]


#1961

FromD.J.W. van Kooten <public@ic2remove.this.com>
Date2011-09-06 11:13 +0200
Message-ID<rqob67dgrabqmgcinoeasjekgqemepkjc9@4ax.com>
In reply to#1951
On Mon, 5 Sep 2011 15:10:04 -0500, "Willie Moore"
<williem@wmconsulting.com> wrote:

Hello Willie,
>
>That is what I was thinking. If a user has not hit a key in 5 days, it 
>shouldn’t hurt to reset it. I have not used bBrowser in this sort of loop 
>but I have done it in GridPro.

The user has used the system all the time and I am sure he's hitting
keys <g>. It is just that GetTickCountLow gets in an overflow after x
days of server uptime, which I think is not a good outcome for any
function. 

Karl calculated 49,7 days, the help says 5 days. I think I saw about a
month uptime in their system and it already went wrong but 49,7 sounds
more logical, otherwise I must have noted it earlier.

But it's safely solved with Seconds() and I think Dirk's Timer
solution could also have solved it.

Thanks everybody!

Dick

[toc] | [prev] | [next] | [standalone]


#1962

Frommalcolm gray <malcolm.gray@ntlworld.com>
Date2011-09-06 11:32 +0100
Message-ID<TEm9q.697$v%1.415@newsfe04.ams2>
In reply to#1945
On 05/09/2011 07:51, D.J.W. van Kooten wrote:
> On Sun, 4 Sep 2011 14:50:56 -0700 (PDT), dlzc<dlzc1@cox.net>  wrote:
>
> Hello David,
>
>> How about moving the stakes forward on string reset?
>>> nNow:=LONGINT(GetTickCountLow()) IF(nNow-SELF:nLastKeyPressTime>1400)
>>>          SELF:cSeek:=""
>>           SELF:nLastKeyPressTime := nNow
>>> ENDIF
>>
> I am not sure what you mean?
>
> Basically, GetTickCountLow is an unusable function as even the help
> says it will give a run time error (numeric overflow) when the server
> is up>5 days which is not that exceptional;...So I need an
> alternative to count milliseconds; the place in the code is ok.

I am convinced your reading of the help is right

obviously iy you convert (rather than cast) to a longint then you are 
causing a numeric overflow but my experience is that if you write the 
code expecting it to wrap it will work fine

[toc] | [prev] | [next] | [standalone]


#1942

From"Bernhard Mayer" <Idonotexisthere@nowhere.com>
Date2011-09-05 07:32 +0200
Message-ID<4e645ee2$0$1575$91cee783@newsreader04.highway.telekom.at>
In reply to#1940
Hello Dick,

what about using the Sleep() function?

BR,
Bernhard

"D.J.W. van Kooten" <public@ic2remove.this.com> schrieb im Newsbeitrag 
news:1qq76794pr6o8jqfmcepteronclarh2kkd@4ax.com...
> In my bBrowser class, Dispatch, I have some code allowing the user to
> autoseek while typing. For that the ideal waiting time until the
> string is reset (e.g.  because someone made a mistake and want to
> start over) is 1400 ms. I used:
>
> nNow:=LONGINT(GetTickCountLow()) IF(nNow-SELF:nLastKeyPressTime>1400)
> SELF:cSeek:=""
> ENDIF
>
> But I read (after an error of course) that this gives a numeric
> overflow error when Windows runs longer than 5 days (not very
> elegantly handled I think)....
>
>
> For now I replaced it with:
>
> nNow:=LONGINT(Secs(Time()))
> which means the waiting time is either 1 seconds (just too short I
> think) or 2 seconds, too long. But Secs() does not return
> milliseconds.
>
> It's not really a big deal but does anyone know which function is
> actually better suited to measure 1400 ms seconds bypassed without
> giving runtime errors?
>
> Dick
>
> 

[toc] | [prev] | [next] | [standalone]


#1943

FromD.J.W. van Kooten <public@ic2remove.this.com>
Date2011-09-05 08:48 +0200
Message-ID<24s867936lr2okm73e1c703iikdg9immdd@4ax.com>
In reply to#1942
On Mon, 5 Sep 2011 07:32:45 +0200, "Bernhard Mayer"
<Idonotexisthere@nowhere.com> wrote:

>Hello Dick,
>
>what about using the Sleep() function?
>
Hello Bernhard,

Thanks, but that won't help in this case. The system should not wait
for it. It should just reset when a user has pressed nothing for more
than 1,4 seconds, so sleep can not be used.

Dick

[toc] | [prev] | [next] | [standalone]


#1944

FromKarl Wochele <kw@e©os-system.de>
Date2011-09-05 08:49 +0200
Message-ID<9cj9ofFa16U1@mid.individual.net>
In reply to#1940
Hi Dick,

you can either use the windows-function GetTickCount() which will work 
for 49.7 days correctly or the VO-function seconds() instead of Secs(). 
Then you will get a float with milliseconds...

Karl

Am 04.09.2011 23:25, schrieb D.J.W. van Kooten:
> In my bBrowser class, Dispatch, I have some code allowing the user to
> autoseek while typing. For that the ideal waiting time until the
> string is reset (e.g.  because someone made a mistake and want to
> start over) is 1400 ms. I used:
>
> nNow:=LONGINT(GetTickCountLow()) IF(nNow-SELF:nLastKeyPressTime>1400)
> 	SELF:cSeek:=""
> ENDIF
>
> But I read (after an error of course) that this gives a numeric
> overflow error when Windows runs longer than 5 days (not very
> elegantly handled I think)....
>
>
> For now I replaced it with:
>
> nNow:=LONGINT(Secs(Time())) 	
> which means the waiting time is either 1 seconds (just too short I
> think) or 2 seconds, too long. But Secs() does not return
> milliseconds.
>
> It's not really a big deal but does anyone know which function is
> actually better suited to measure 1400 ms seconds bypassed without
> giving runtime errors?
>
> Dick
>
>

[toc] | [prev] | [next] | [standalone]


#1946

FromD.J.W. van Kooten <public@ic2remove.this.com>
Date2011-09-05 13:16 +0200
Message-ID<rrb967to01st5cbgren0pudbds8u99hk46@4ax.com>
In reply to#1944
On Mon, 05 Sep 2011 08:49:51 +0200, Karl Wochele <kw@e©os-system.de>
wrote:

Hello Karl,
>
>you can either use the windows-function GetTickCount() which will work 
>for 49.7 days correctly or the VO-function seconds() instead of Secs(). 
>Then you will get a float with milliseconds...

Right, but that's why I posted this: I DID use that and I think using
a function from which the help already says:

"Because of the range of a DWORD, after 5 days there will be a numeric
overflow."

..is not a good solution.

Question was if there's some alternative measuring if we're 1400 ms
further without using a function which gives a runtime error.

Dick

[toc] | [prev] | [next] | [standalone]


#1947

FromKarl Wochele <kw@e©os-system.de>
Date2011-09-05 13:42 +0200
Message-ID<9cjqtgFm20U1@mid.individual.net>
In reply to#1946
Hi Dick,

seconds() should be the solution. Multiply the result by 1000 and you 
will have milliseconds...

HTH
Karl



Am 05.09.2011 13:16, schrieb D.J.W. van Kooten:
> On Mon, 05 Sep 2011 08:49:51 +0200, Karl Wochele<kw@e©os-system.de>
> wrote:
>
> Hello Karl,
>>
>> you can either use the windows-function GetTickCount() which will work
>> for 49.7 days correctly or the VO-function seconds() instead of Secs().
>> Then you will get a float with milliseconds...
>
> Right, but that's why I posted this: I DID use that and I think using
> a function from which the help already says:
>
> "Because of the range of a DWORD, after 5 days there will be a numeric
> overflow."
>
> ..is not a good solution.
>
> Question was if there's some alternative measuring if we're 1400 ms
> further without using a function which gives a runtime error.
>
> Dick
>

[toc] | [prev] | [next] | [standalone]


#1948

FromD.J.W. van Kooten <public@ic2remove.this.com>
Date2011-09-05 15:14 +0200
Message-ID<ami967p8dm7etjloitrugfh6pm4oo199av@4ax.com>
In reply to#1947
On Mon, 05 Sep 2011 13:42:40 +0200, Karl Wochele <kw@e©os-system.de>
wrote:

>seconds() should be the solution. Multiply the result by 1000 and you 
>will have milliseconds...
>

Hello Karl,


I am afraid not. Seconds returns seconds, not milliseconds. So even if
I multiply it with a million, I can still only measure if 1 seconds
passed or 2 but not 1,4.

Dick

[toc] | [prev] | [next] | [standalone]


#1949

FromKarl Wochele <kw@e©os-system.de>
Date2011-09-05 15:27 +0200
Message-ID<9ck12iFbfvU1@mid.individual.net>
In reply to#1948
Hello Dick,

 > I am afraid not. Seconds returns seconds, not milliseconds. So even if
 > I multiply it with a million, I can still only measure if 1 seconds
 > passed or 2 but not 1,4.

well, not over here...

I just tested

? Seconds()
Sleep(10)
? Seconds()
Sleep(10)
? Seconds()
Sleep(10)
? Seconds()
Sleep(10)
? Seconds()

The result was

55369,40
55369,42
55369,43
55369,45
55369,47

which means seconds() has a resolution of 1/100 of a second. This might 
be hardware-related but seconds() definitely returns a float.

Karl

Am 05.09.2011 15:14, schrieb D.J.W. van Kooten:
> On Mon, 05 Sep 2011 13:42:40 +0200, Karl Wochele<kw@e©os-system.de>
> wrote:
>
>> seconds() should be the solution. Multiply the result by 1000 and you
>> will have milliseconds...
>>
>
> Hello Karl,
>
>
> I am afraid not. Seconds returns seconds, not milliseconds. So even if
> I multiply it with a million, I can still only measure if 1 seconds
> passed or 2 but not 1,4.
>
> Dick

[toc] | [prev] | [next] | [standalone]


#1960

FromD.J.W. van Kooten <public@ic2remove.this.com>
Date2011-09-06 10:57 +0200
Message-ID<i0ob67p2itj6gt7cg4939u5avvo9ff0ftu@4ax.com>
In reply to#1949
On Mon, 05 Sep 2011 15:27:46 +0200, Karl Wochele <kw@e©os-system.de>
wrote:

Hello Karl,

>well, not over here...
>
>I just tested

Indeed.I was concentrating on the Secs() function which returns dword
so full seconds. But with Seconds() it works like a charm again. 

Thank you! 

Dick

[toc] | [prev] | [next] | [standalone]


#1953

FromE®!k \\/!$$E® <nospam@nospam.url>
Date2011-09-06 09:46 +0200
Message-ID<9cm1edF6fmU1@mid.individual.net>
In reply to#1940
Hi Dick,

I will not say the VO doc's lie about this, but they sure 'differ in 
opinion'    from the MS documentation.
Microsoft says:
"The elapsed time is stored as a DWORD value. Therefore, the time will wrap 
around to zero if the system is run continuously for 49.7 days. "

And 49.7 x 24 x 3600 * 1000 = 4.294.080.000  Now that comes close to the 
MaxDword value : 4.294.967.295
So Robert (or whoever wrote this VO helppage) is about 10 times wrong here. 
<g>

But this is not as interesting as the rest of the MS documentation, as it 
continues with:

"To avoid this problem, use the GetTickCount64 function."


hth

Erik






"D.J.W. van Kooten"  schreef in bericht 
news:1qq76794pr6o8jqfmcepteronclarh2kkd@4ax.com...

In my bBrowser class, Dispatch, I have some code allowing the user to
autoseek while typing. For that the ideal waiting time until the
string is reset (e.g.  because someone made a mistake and want to
start over) is 1400 ms. I used:

nNow:=LONGINT(GetTickCountLow()) IF(nNow-SELF:nLastKeyPressTime>1400)
SELF:cSeek:=""
ENDIF

But I read (after an error of course) that this gives a numeric
overflow error when Windows runs longer than 5 days (not very
elegantly handled I think)....


For now I replaced it with:

nNow:=LONGINT(Secs(Time()))
which means the waiting time is either 1 seconds (just too short I
think) or 2 seconds, too long. But Secs() does not return
milliseconds.

It's not really a big deal but does anyone know which function is
actually better suited to measure 1400 ms seconds bypassed without
giving runtime errors?

Dick

[toc] | [prev] | [next] | [standalone]


#1955

FromE®!k \\/!$$E® <nospam@nospam.url>
Date2011-09-06 10:18 +0200
Message-ID<9cm3akFltgU1@mid.individual.net>
In reply to#1953
> So Robert (or whoever wrote this VO helppage) is about 10 times wrong 
> here.

Unfortunately this bug in the helpfile is already there in the VO 2.5 docs, 
so most likely it wasn't Robert who wrote it.

Erik




"E®!k \/!$$E®"  schreef in bericht news:9cm1edF6fmU1@mid.individual.net...

Hi Dick,

I will not say the VO doc's lie about this, but they sure 'differ in
opinion'    from the MS documentation.
Microsoft says:
"The elapsed time is stored as a DWORD value. Therefore, the time will wrap
around to zero if the system is run continuously for 49.7 days. "

And 49.7 x 24 x 3600 * 1000 = 4.294.080.000  Now that comes close to the
MaxDword value : 4.294.967.295
So Robert (or whoever wrote this VO helppage) is about 10 times wrong here.
<g>

But this is not as interesting as the rest of the MS documentation, as it
continues with:

"To avoid this problem, use the GetTickCount64 function."


hth

Erik






"D.J.W. van Kooten"  schreef in bericht
news:1qq76794pr6o8jqfmcepteronclarh2kkd@4ax.com...

In my bBrowser class, Dispatch, I have some code allowing the user to
autoseek while typing. For that the ideal waiting time until the
string is reset (e.g.  because someone made a mistake and want to
start over) is 1400 ms. I used:

nNow:=LONGINT(GetTickCountLow()) IF(nNow-SELF:nLastKeyPressTime>1400)
SELF:cSeek:=""
ENDIF

But I read (after an error of course) that this gives a numeric
overflow error when Windows runs longer than 5 days (not very
elegantly handled I think)....


For now I replaced it with:

nNow:=LONGINT(Secs(Time()))
which means the waiting time is either 1 seconds (just too short I
think) or 2 seconds, too long. But Secs() does not return
milliseconds.

It's not really a big deal but does anyone know which function is
actually better suited to measure 1400 ms seconds bypassed without
giving runtime errors?

Dick 

[toc] | [prev] | [next] | [standalone]


#1956

FromKarl Wochele <kw@e©os-system.de>
Date2011-09-06 10:25 +0200
Message-ID<9cm3nkFnovU1@mid.individual.net>
In reply to#1955
Hi Erik,

there is no bug in the documentation as GetTickCount returns 
milliseconds and GetTickCountLow returns 1/10000 seconds. So this is 
where the factor 10 comes from...

Karl

Am 06.09.2011 10:18, schrieb E®!k \/!$$E®:
>> So Robert (or whoever wrote this VO helppage) is about 10 times wrong
>> here.
>
> Unfortunately this bug in the helpfile is already there in the VO 2.5
> docs, so most likely it wasn't Robert who wrote it.
>
> Erik
>
>
>
>
> "E®!k \/!$$E®" schreef in bericht news:9cm1edF6fmU1@mid.individual.net...
>
> Hi Dick,
>
> I will not say the VO doc's lie about this, but they sure 'differ in
> opinion' from the MS documentation.
> Microsoft says:
> "The elapsed time is stored as a DWORD value. Therefore, the time will wrap
> around to zero if the system is run continuously for 49.7 days. "
>
> And 49.7 x 24 x 3600 * 1000 = 4.294.080.000 Now that comes close to the
> MaxDword value : 4.294.967.295
> So Robert (or whoever wrote this VO helppage) is about 10 times wrong here.
> <g>
>
> But this is not as interesting as the rest of the MS documentation, as it
> continues with:
>
> "To avoid this problem, use the GetTickCount64 function."
>
>
> hth
>
> Erik
>
>
>
>
>
>
> "D.J.W. van Kooten" schreef in bericht
> news:1qq76794pr6o8jqfmcepteronclarh2kkd@4ax.com...
>
> In my bBrowser class, Dispatch, I have some code allowing the user to
> autoseek while typing. For that the ideal waiting time until the
> string is reset (e.g. because someone made a mistake and want to
> start over) is 1400 ms. I used:
>
> nNow:=LONGINT(GetTickCountLow()) IF(nNow-SELF:nLastKeyPressTime>1400)
> SELF:cSeek:=""
> ENDIF
>
> But I read (after an error of course) that this gives a numeric
> overflow error when Windows runs longer than 5 days (not very
> elegantly handled I think)....
>
>
> For now I replaced it with:
>
> nNow:=LONGINT(Secs(Time()))
> which means the waiting time is either 1 seconds (just too short I
> think) or 2 seconds, too long. But Secs() does not return
> milliseconds.
>
> It's not really a big deal but does anyone know which function is
> actually better suited to measure 1400 ms seconds bypassed without
> giving runtime errors?
>
> Dick

[toc] | [prev] | [next] | [standalone]


#1958

FromE®!k \\/!$$E® <nospam@nospam.url>
Date2011-09-06 10:30 +0200
Message-ID<9cm421Fs0bU1@mid.individual.net>
In reply to#1956
Hi Karl,
Ha! Should have read better.
Anyway, the Win32 API function GetTickCount64() does not have this problem.

Erik

"Karl Wochele"  schreef in bericht news:9cm3nkFnovU1@mid.individual.net...

Hi Erik,

there is no bug in the documentation as GetTickCount returns
milliseconds and GetTickCountLow returns 1/10000 seconds. So this is
where the factor 10 comes from...

Karl

Am 06.09.2011 10:18, schrieb E®!k \/!$$E®:
>> So Robert (or whoever wrote this VO helppage) is about 10 times wrong
>> here.
>
> Unfortunately this bug in the helpfile is already there in the VO 2.5
> docs, so most likely it wasn't Robert who wrote it.
>
> Erik
>
>
>
>
> "E®!k \/!$$E®" schreef in bericht news:9cm1edF6fmU1@mid.individual.net...
>
> Hi Dick,
>
> I will not say the VO doc's lie about this, but they sure 'differ in
> opinion' from the MS documentation.
> Microsoft says:
> "The elapsed time is stored as a DWORD value. Therefore, the time will 
> wrap
> around to zero if the system is run continuously for 49.7 days. "
>
> And 49.7 x 24 x 3600 * 1000 = 4.294.080.000 Now that comes close to the
> MaxDword value : 4.294.967.295
> So Robert (or whoever wrote this VO helppage) is about 10 times wrong 
> here.
> <g>
>
> But this is not as interesting as the rest of the MS documentation, as it
> continues with:
>
> "To avoid this problem, use the GetTickCount64 function."
>
>
> hth
>
> Erik
>
>
>
>
>
>
> "D.J.W. van Kooten" schreef in bericht
> news:1qq76794pr6o8jqfmcepteronclarh2kkd@4ax.com...
>
> In my bBrowser class, Dispatch, I have some code allowing the user to
> autoseek while typing. For that the ideal waiting time until the
> string is reset (e.g. because someone made a mistake and want to
> start over) is 1400 ms. I used:
>
> nNow:=LONGINT(GetTickCountLow()) IF(nNow-SELF:nLastKeyPressTime>1400)
> SELF:cSeek:=""
> ENDIF
>
> But I read (after an error of course) that this gives a numeric
> overflow error when Windows runs longer than 5 days (not very
> elegantly handled I think)....
>
>
> For now I replaced it with:
>
> nNow:=LONGINT(Secs(Time()))
> which means the waiting time is either 1 seconds (just too short I
> think) or 2 seconds, too long. But Secs() does not return
> milliseconds.
>
> It's not really a big deal but does anyone know which function is
> actually better suited to measure 1400 ms seconds bypassed without
> giving runtime errors?
>
> Dick 

[toc] | [prev] | [next] | [standalone]


#1957

FromKarl Faller <k.faller_withoutthat_@onlinehome.de>
Date2011-09-06 10:29 +0200
Message-ID<tllb67pe93c8fgdp8md2eselfl3pmmonom@4ax.com>
In reply to#1953
Erik,
maybe i'm "sensitive", but why "lie" again?

And just in case you would have tested as in: 
FUNCTION Start()
LOCAL n, k AS DWORD
? n:=  GetTickCountLow()
Sleep(10000)
? k:= GetTickCountLow()
? k-n
WAIT
RETURN NIL	

you could have noticed that the difference result is 100.000, not
10.0000..
I have no idea, if and how VO manages "tenths of milliseconds", but it
is clearly stated in the help: 
Returns
The number of 1/10000 seconds (milliseconds/10) that have elapsed
since Windows was last started. 


BTW, my Win32SDK shows the entry re 49,7 days below "GetTickCount",
NOT GetTickCountLow()
And, Vo provides a GetTickCount() as a GetTickCountLow(), the first
pointing to Kernel32 while the second points into the runtime, so it
may very well be different implemented...

So, for Dick, GetTickCount64 (function is limited to the resolution of
the system timer, which is typically in the range of 10 milliseconds
to 16milliseconds) might solve his problem, although an "non resetted
counter" based method might be prone to fail, at least on servers
after some 500 days...


Regards
Karl


>Hi Dick,
>
>I will not say the VO doc's lie about this, but they sure 'differ in 
>opinion'    from the MS documentation.
>Microsoft says:
>"The elapsed time is stored as a DWORD value. Therefore, the time will wrap 
>around to zero if the system is run continuously for 49.7 days. "
>
>And 49.7 x 24 x 3600 * 1000 = 4.294.080.000  Now that comes close to the 
>MaxDword value : 4.294.967.295
>So Robert (or whoever wrote this VO helppage) is about 10 times wrong here. 
><g>
>
>But this is not as interesting as the rest of the MS documentation, as it 
>continues with:
>
>"To avoid this problem, use the GetTickCount64 function."
>
>
>hth
>
>Erik
>
>
>
>
>
>
>"D.J.W. van Kooten"  schreef in bericht 
>news:1qq76794pr6o8jqfmcepteronclarh2kkd@4ax.com...
>
>In my bBrowser class, Dispatch, I have some code allowing the user to
>autoseek while typing. For that the ideal waiting time until the
>string is reset (e.g.  because someone made a mistake and want to
>start over) is 1400 ms. I used:
>
>nNow:=LONGINT(GetTickCountLow()) IF(nNow-SELF:nLastKeyPressTime>1400)
>SELF:cSeek:=""
>ENDIF
>
>But I read (after an error of course) that this gives a numeric
>overflow error when Windows runs longer than 5 days (not very
>elegantly handled I think)....
>
>
>For now I replaced it with:
>
>nNow:=LONGINT(Secs(Time()))
>which means the waiting time is either 1 seconds (just too short I
>think) or 2 seconds, too long. But Secs() does not return
>milliseconds.
>
>It's not really a big deal but does anyone know which function is
>actually better suited to measure 1400 ms seconds bypassed without
>giving runtime errors?
>
>Dick

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web