Just time by itself, with *no* conversion at all :)
You don't need a conversion to display the output of TIME()
Quantized, means it comes in "little packets", and the packet size is bigger 
than "1" is what I'm saying.


 

 

 

-----Original Message-----
From: Doug Farmer <dfar...@epicor.com>
To: 'U2 Users List' <u2-users@listserver.u2ug.org>
Sent: Fri, Dec 28, 2012 9:32 am
Subject: Re: [U2] Sleeping in Basic


I guess I am confused on the definition of "quantized". NAP 250 seems to do 
what 
I want. Doing a LOOP 1000 and NAP 1 inside the loop, makes it takes quite a few 
seconds, where I would assume it would be 1 second (1000 x 1 millisecond - 1 
second). However, loop 20 with NAP 250 in the loop takes 5 seconds, which is 
what I would expect (20 x 250 milliseconds = 5 seconds).

Also, the OCONV documentation only shows OCONV(num.expr,"MT[H][S][c]") as a 
syntax. No option for displaying milliseconds. The only why I know to do that 
is 
to use SYSTEM(12).

I guess I was just using TIME() not SYSTEM(12) as it was easier to visually 
scan.

Doug Farmer
952-417-5225


-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] 
On Behalf Of Wjhonson
Sent: Friday, December 28, 2012 11:16 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Sleeping in Basic

Your napping for a quarter of a second is too long :) I was saying that NAP is 
quantized.  You can't actually NAP for a microsecond.
So loop 1000 and NAP 1
By the way you can return the microseconds, why are you doing MTS

 
I never bothered to dig into it, to see on what it's quantized.

Without MTS you can see the microseconds.

 

 

-----Original Message-----
From: Doug Farmer <dfar...@epicor.com>
To: 'U2 Users List' <u2-users@listserver.u2ug.org>
Sent: Fri, Dec 28, 2012 7:22 am
Subject: Re: [U2] Sleeping in Basic


Wow, thanks of all of the responses. Unfortunately, none of them will seem to 
work on UniData. I will be using NAP on UniVerse.

PAUSE and WAKE, I had not heard of. This is only on UniData so not a UniVerse 
option. It would seem to be a good way to go, except for if the phantom process 
aborts, the WAKE is never executed and the invoking process (UniObjects
subroutine) hangs forever.

David's openSocket suggestion does not wait at all if the socket can be opened. 
If it cannot (for example host name is bad), the timeout is sometimes much 
longer, probably due to DNS lookup of the bad host name.

I tried these examples in the code below. The results are show below the code.


When I run this, using NAP 250, I get 4 times the same, then another 4 times 
the 
same etc. This seems to show NAP 250 does sleep for a quarter of a second. 

Doing NAP 1 for 2000 iterations took 31 seconds. Probably due to overhead of 
setting up NAP 2000 times.

The openSocket came right back all the time.

Any other ideas, I am open to testing.

Again, thanks for all of the responses!


Doug Farmer
952-417-5225
Program Listing

0001       PRINT 'Nap 250'
0002       FOR IDX = 1 TO 20
0003          PRINT IDX "R#2":' ':OCONV(TIME(),'MTS')
0004          NAP 250
0005       NEXT IDX
0006       PRINT 'Start of 2000'
0007       PRINT OCONV(TIME(),'MTS')
0008       FOR IDX = 1 TO 2000
0009          NAP 1
0010       NEXT IDX
0011       PRINT OCONV(TIME(),'MTS')
0012       PRINT 'DONE WITH 2000'
0013       PRINT 'Open Socket'
0014       FOR IDX = 1 TO 20
0015          SleepTime = 250
0016          ERR = openSocket('loopback',25,1,SleepTime,HBUFF)
0017          PRINT IDX "R#2":' ':OCONV(TIME(),'MTS')
0018       NEXT IDX

Output from Program
Nap 250
 1 09:11:29
 2 09:11:29
 3 09:11:29
 4 09:11:30
 5 09:11:30
 6 09:11:30
 7 09:11:30
 8 09:11:31
 9 09:11:31
10 09:11:31
11 09:11:31
12 09:11:32
13 09:11:32
14 09:11:32
15 09:11:32
16 09:11:33
17 09:11:33
18 09:11:33
19 09:11:33
20 09:11:34
Start of 2000
09:11:34
09:12:05
DONE WITH 2000
Open Socket
 1 09:12:05
 2 09:12:05
 3 09:12:05
 4 09:12:05
 5 09:12:05
 6 09:12:05
 7 09:12:05
 8 09:12:05
 9 09:12:05
10 09:12:05
11 09:12:05
12 09:12:05
13 09:12:05
14 09:12:05
15 09:12:05
16 09:12:05
17 09:12:05
18 09:12:05
19 09:12:05
20 09:12:05



This message has been scanned for malware by Websense. www.websense.com 
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

 
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Click 
https://www.mailcontrol.com/sr/6lVGIXxG7qjGX2PQPOmvUlpAWghQWIvzb3YGjzkT!7MOUCUpiqnJJoGBzmYgl5U4YPnWx2HtmVnUfE+mA+MlhQ==
  
to report this email as spam.
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

 
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to