Up Time Percentage

By pball on Oct 31, 2011

This little snippet tracks mIRC's uptime as a percentage using the time mIRC has been open divided by the time since the script was started. It even protects against crashes by periodically saving the uptime.

Just load the snippet and type /uppercent to see how much of the time since you loaded the script mIRC has been running.

Example:

Uptime Percentage: 99.235506% since Mon Oct 31 23:50:49 2011 (49 seconds later) Uptime Percentage: 99.24338% since Mon Oct 31 23:50:49 2011 You can watch your up time percentage increase the longer you've been up, assuming you aren't at 100%. Just know that once you drop below 100% it's impossible to reach 100% (theoretically at least, rounding will let you get 100% after long enough lol). ```mirc /* [Addon] Script=Uptime Counter Version=1 Author=pball Desc=Tracks uptime of mIRC For=Mirc Date=10-31-2011 [script] */ on *:start:{ if (!%uptimepercent.beginning) set %uptimepercent.beginning $ctime if (%uptimepercent.temp) set %uptimepercent.up $calc(%uptimepercent.up + (%uptimepercent.temp - %uptimepercent.start)) set %uptimepercent.start $ctime .timer -o 0 600 set %uptimepercent.temp $!ctime } on *:exit:{ set %uptimepercent.up $calc(%uptimepercent.up + ($ctime - %uptimepercent.start)) unset %uptimepercent.temp } alias uppercent { say 7Uptime Percentage: $calc(100* ( %uptimepercent.up + ( $ctime - %uptimepercent.start )) / ( $ctime - %uptimepercent.beginning ) ) $+ % since $asctime(%uptimepercent.beginning) } ```

Comments

Sign in to comment.
SReject   -  Nov 06, 2011

Sorry, Yea you are right. But I fixed it :)

 Respond  
pball   -  Nov 04, 2011

SReject the point is that $uptime will cause the initial time to be off, since it will be longer than the time script has been loaded unless you load the script when you start mirc up

 Respond  
Firstmate   -  Nov 04, 2011

Jethro, you started it, let's not try and get fancy...
I'm not taking sides, you both are being silly, but c'mon...

 Respond  
SReject   -  Nov 03, 2011

I do believe this is wut dani was trying to do:

on *:LOAD:set %UTPerc:Beg $ctime
on *:START:set -e %UTPerc:Str $ctime

alias uppercent {
  var %p = $round($calc(($ctime - %UTPerc:Str + %UTPerc:Tot) / ($ctime - %UTPerc:Beg) * 100),2) $+ %
  say Uptime Precent: %p since $asctime(%UTPerc:Beg)
}
on *:EXIT:inc %UTPerc:Tot $calc($ctime - %UTPerc:Str)
on *:UNLOAD:unset %UTPerc:*
 Respond  
Jethro   -  Nov 02, 2011

napa182, I was just saying has has a fond admiration for jaytea is all, and then he called me a name. He has a constant period outbreak for no reason. I don't know why, but then when you look at his avatar, which shows a long, pissed-off face, and my comment, you'll begin to know why.

Thanks pball, I wish everybody could be as open minded as you. Let's all be happy, excluding the mad one up there, shall we?

P.S. I feel bad napa182 has to endure this unexpected ordeal and makes himself available for comment after being unavailable for a while.

 Respond  
pball   -  Nov 01, 2011

I love how most of my scripts end up with more random comments that related ones ^_^

 Respond  
napa182   -  Nov 01, 2011

are you two hens done clucking?
or is this going to be another pissing match?

 Respond  
_Dean_   -  Nov 01, 2011

i see we have an idiot that quotes everything from ppl ^
and below i see idiots who will agree with the idiot above me

 Respond  
Jethro   -  Nov 01, 2011

nice one jayteaI see we have another secret admirer. ^

 Respond  
konsumer   -  Nov 01, 2011

pball makes all my scripts for mirc. How can i not click the Like button :)

 Respond  
pball   -  Nov 01, 2011

actually jaytea is right, he's my groupie. Which I'm not sure if that's good or bad. But I've scripted a bunch of stuff for him over the time I've known him.

 Respond  
_Dean_   -  Nov 01, 2011

or probably we have double accounts, giving to himself a lot of likes...
nice one jaytea

 Respond  
Jethro   -  Nov 01, 2011

I see we have a secret admirer. ^

 Respond  
jaytea   -  Nov 01, 2011

I like the version pball made. It actually works.

you seem to like a lot of the things pball made ;P

 Respond  
pball   -  Nov 01, 2011

That wouldn't work well for people who replace the exe to update like me. That also does online time verses uptime which is what I'm going more for. So if your internet goes off the online timer stops until you reconnect. Since I personally have mirc open all the time my computer is running.

edit:
slightly better example of why not to check mirc.exe creation date. many people use already setup clients and the creation date would be whenever that was originally setup

 Respond  
TheImrac   -  Nov 01, 2011

Could always look at the creation date of the mirc.exe file and compare it to the $online timer

$calc($online / ($ctime - $file(C:\Program Files (x86)\mIRC\mirc.exe).ctime)) 
 Respond  
konsumer   -  Nov 01, 2011

I like the version pball made. It actually works.
Dani_l11: You get a gold star for your effort.

 Respond  
pball   -  Nov 01, 2011

I don't know if you tested that but I noticed a problem with your math, you don't want to subtract $ctime from $uptime in the first part of the math. You are also missing a ) at the end of your $calc statement.

Also this will provide incorrect results if you use $uptime. Because if you load this after mirc has been running the uptime will be larger than the time the script has been running. Which will result in an uptime of over 100% which is incorrect.

Example of loading script and showing output:
<~pballz> Uptime Percentage: 163157.5% since Tue Nov 01 17:59:08 2011

 Respond  
Dani_l11   -  Nov 01, 2011
On *:load: set %uptime.start $ctime
on *:Exit: inc %uptime.up $uptime 
alias upperpercent  say 7Uptime Percentage: $calc(100 * ((%uptime.up + $uptime) / ($ctime - %uptime.start))) $+ % since $asctime(%uptime.start) 
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.