Board Logo
« Time$() behaviour differs »

Welcome Guest. Please Login or Register.
Dec 12th, 2017, 09:54am


Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Time$() behaviour differs  (Read 97 times)
Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3142
xx Time$() behaviour differs
« Thread started on: Nov 25th, 2017, 11:51am »

I believe the time$() function has changed behaviour. Its not a bug and it has changed on LB v4.5

When I used to run this code there was a consistent 16ms delay before the time$("ms") function would return a "new" time.

I always assumed that Windows only updated the clock every 16ms, 60Hertz. But now I am getting millisecond variances.

So perhaps it was/is a message passing delay? I get 16ms delays then a run of millisecond delays?

Code:
for n= 1 to 500
    t=time$("ms")
    print t,t-tt
    tt=t
next
 


Quote:
64173335 16
64173335 0
64173335 0
64173351 16
64173351 0
64173351 0
64173366 15
64173366 0
64173366 0
64173382 16
64173382 0
64173398 16
64173398 0
64173398 0
64173416 18
64173419 3
64173419 0
64173419 0
64173419 0
64173435 16
64173435 0
64173435 0
64173451 16
64173451 0
64173451 0
64173451 0
64173466 15
64173466 0
64173466 0
64173482 16
64173482 0
64173482 0
64173482 0
64173498 16
64173498 0
64173498 0
64173518 20
64173519 1
64173519 0
64173535 16
64173535 0
64173535 0
64173551 16
64173551 0
64173551 0
64173567 16
64173567 0
64173567 0
64173567 0
64173582 15
64173582 0
64173582 0
64173598 16
64173598 0
64173598 0
64173614 16
64173618 4
64173620 2
64173620 0
64173620 0
64173636 16
64173636 0
64173636 0
64173636 0
64173651 15
64173651 0
64173651 0
64173667 16
64173667 0
64173682 15
64173682 0
64173682 0
64173702 20
64173709 7
64173714 5
64173719 5
64173723 4
64173730 7
64173737 7
64173742 5
64173749 7
64173753 4
64173757 4
64173762 5
64173767 5
64173771 4
64173776 5
64173780 4
64173785 5
64173789 4
64173794 5
64173798 4
64173802 4
64173806 4
64173811 5
64173816 5
64173819 3
64173825 6
64173832 7
64173836 4
64173840 4
64173845 5
64173849 4
64173854 5
64173859 5
64173865 6
64173871 6
64173878 7
64173884 6
64173890 6
64173897 7
64173903 6
64173910 7
64173914 4
64173919 5
64173923 4
64173928 5
64173932 4
64173937 5
64173942 5
64173947 5
64173951 4
64173955 4
64173960 5
64173965 5
64173969 4
64173973 4
64173978 5
64173983 5
64173987 4
64173992 5
64173998 6
64174002 4
64174006 4
64174012 6
64174017 5
64174020 3
64174020 0
64174020 0
64174036 16
64174036 0
64174036 0
64174036 0
64174051 15
64174051 0
64174051 0
64174051 0
64174067 16
64174067 0

« Last Edit: Nov 25th, 2017, 11:53am by Rod » User IP Logged

tsh73
JB-Supporter


member is offline

Avatar




PM

Gender: Male
Posts: 3629
xx Re: Time$() behaviour differs
« Reply #1 on: Nov 25th, 2017, 2:01pm »

I see no difference under Win 10 between 1.01 and 2.0b1.
Indeed if I change printing to screen to writing to a file I get steady 1 ms.
It looks Win10 changed that "16 ms" rule of WinXP.
Code:
open "test.txt" for output as #1
for n= 1 to 5000
    t=time$("ms")
    if t <> tt then
    print #1, n;" ";t;" ";t-tt
    'print t;" ";t-tt
    tt=t
    end if
next
close #1

run "notepad.exe test.txt"
 

Code:
1 82515417 82515417
52 82515418 1
129 82515419 1
207 82515420 1
256 82515421 1
333 82515422 1
411 82515423 1
488 82515424 1
566 82515425 1
644 82515426 1
709 82515427 1
751 82515428 1
824 82515429 1
889 82515430 1
955 82515431 1
1019 82515432 1
1090 82515433 1
1167 82515434 1
1223 82515435 1
1300 82515436 1
1377 82515437 1
1452 82515438 1
1529 82515439 1
1605 82515440 1
1682 82515441 1
1756 82515442 1
1817 82515443 1
1889 82515444 1
1962 82515445 1
2027 82515446 1
2097 82515447 1
2171 82515448 1
2247 82515449 1
2314 82515450 1
2390 82515451 1
2467 82515452 1
2544 82515453 1
2620 82515454 1
2697 82515455 1
2774 82515456 1
2843 82515457 1
2893 82515458 1
2967 82515459 1
3035 82515460 1
3110 82515461 1
3177 82515462 1
3236 82515463 1
3311 82515464 1
3380 82515465 1
3456 82515466 1
3534 82515467 1
3611 82515468 1
3688 82515469 1
3725 82515470 1
3802 82515471 1
3867 82515472 1
3935 82515473 1
4012 82515474 1
4089 82515475 1
4160 82515476 1
4230 82515477 1
4299 82515478 1
4369 82515479 1
4441 82515480 1
4509 82515481 1
4585 82515482 1
4662 82515483 1
4739 82515484 1
4816 82515485 1
4893 82515486 1
4970 82515487 1
 


EDIT
no difference under Win XP either, steady 15-16 ms
Code:
1 83673750 83673750
2 83673765 15
847 83673781 16
1756 83673796 15
2755 83673812 16
3580 83673828 16
4503 83673843 15
 
« Last Edit: Nov 25th, 2017, 2:18pm by tsh73 » User IP Logged

Q: "And if I took your codes and compile them, and sell them for a profit"?
A: Go ahead. I had my share of good then I coded it for fun, if you can make better use of it - please do.
(enjoying JB 1.01 on WinXP, netbook and desktop)
rtr
Member in Training
ImageImage


member is offline

Avatar




PM


Posts: 40
xx Re: Time$() behaviour differs
« Reply #2 on: Nov 26th, 2017, 03:54am »

on Nov 25th, 2017, 2:01pm, tsh73 wrote:
It looks Win10 changed that "16 ms" rule of WinXP.

This changed a long time ago, in Windows Vista I think:

"Before Vista, both GetLocalTime and GetSystemTime return current time with millisecond precision, but they are not accurate to a millisecond. Their accuracy is typically in the range of 10 to 55 milliseconds (precision is not the same as accuracy). On Vista, GetLocalTime and GetSystemTime both work with 1 ms resolution."

Richard.
User IP Logged

Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3142
xx Re: Time$() behaviour differs
« Reply #3 on: Nov 26th, 2017, 04:26am »

Good to know. But why does the 16ms delay persist? I suppose it might well be the print to screen command that is introducing the delay in my code. It might be that scrolling/ off screen printing accelerates the loop.

So we now know that time$() returns true millisecond precision. Cool.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Just BASIC wiki
Wikispaces

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls