egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

trim number [solved]

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
tueb
Halfop


Joined: 04 Oct 2007
Posts: 76
Location: #quiz.de @ irc.gamesurge.net

PostPosted: Wed Dec 22, 2010 6:03 am    Post subject: trim number [solved] Reply with quote

Hi,

I calculate a duration by milliseconds by using:

"set dur [expr ([clock clicks -milliseconds] - $timeasked) * 0.001]"

that usually gives me a time like "64.409".

But on some networks (i.e. quakenet) i get times like "64.408999999999999".

How do i trim the number to three decimals?


thanks in advance,

tueb
_________________
#Quiz.de @ irc.GameSurge.net
JavaChat


Last edited by tueb on Wed Dec 22, 2010 7:00 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Wed Dec 22, 2010 6:58 am    Post subject: Re: trim number Reply with quote

Code:
set dur [format %.3f [expr {([clock clicks -milliseconds] - $timeasked) * 0.001}]]

_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
tueb
Halfop


Joined: 04 Oct 2007
Posts: 76
Location: #quiz.de @ irc.gamesurge.net

PostPosted: Wed Dec 22, 2010 7:00 am    Post subject: Reply with quote

thanks!
_________________
#Quiz.de @ irc.GameSurge.net
JavaChat
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber