Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / How to conver timestamp$ string to value for ping calculation

Author
Message
Sph!nx
17
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 15th Sep 2013 23:41
I use IanM's matrix plugins 'timestamp$()' command.

I would figure this would convert it to values I could use to calculate latency...




However, it does not accept it. It puts + and e and other character, so it cannot be used.

Any ideas on how to get this working, or get milliseconds another way? Normal get time$() will not add milliseconds...

Any help is much appreciated!

Regards Sph!nx
www.mental-image.net
SamKM
17
Years of Service
User Offline
Joined: 25th May 2009
Location:
Posted: 15th Sep 2013 23:56
You could try just cutting out the bit you need, and converting that to a value, like

That seems to work!
I honestly have never made any kind of networked game or program with DBPro, so my guess is you already know a lot more than me about this, but wouldn't timer commands be better for calculating latency?
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 15th Sep 2013 23:59 Edited at: 16th Sep 2013 00:00
Well, e+some_other_character simply means the number is multiplied by 10 raised to the power of some_other_character. I suppose you could do the conversion like this:



(not tested)

For instance, 2.542e2 translates to 2.542*10^2, which equals 254.2.

TheComet

horses
Sph!nx
17
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 16th Sep 2013 00:02 Edited at: 16th Sep 2013 00:03
Timer... DOH! Why didn't I think of it! Thanks for the quick reply, though.

What I still do not understand is why it will not convert as it should. Well, I can continue anyway.

EDIT
TheComet, Thanks!!

Regards Sph!nx
www.mental-image.net

Login to post a reply

Server time is: 2026-07-06 20:16:13
Your offset time is: 2026-07-06 20:16:13