|
Joined: Mar 2007
Posts: 218
Fjord artisan
|
OP
Fjord artisan
Joined: Mar 2007
Posts: 218 |
Ok i have an alias which turns a duration format into.. 04:11:59 hh:mm:ss ;; $formtime($uptime(server,3)) etc alias formtime {
var %a = $round($1,0)
var %s = $calc(%a % 60)
var %h = $int($calc(%a / 3600))
var %m = $int($calc(((%a - (%h * 3600))) / 60))
return $base(%h,10,10,2) $+ : $+ $base(%m,10,10,2) $+ : $+ $base(%s,10,10,2)
} I was wondering how to get that to return a format of 01:04:11:59 dd:hh:mm:ss thanks for any help.
Last edited by vexed2; 05/09/07 01:48 PM.
|
|
|
|
Joined: Aug 2005
Posts: 1,052
Hoopy frood
|
Hoopy frood
Joined: Aug 2005
Posts: 1,052 |
Ok i have an alias which turns a duration format into.. 04:11:59 hh:mm:ss ;; $formtime($uptime(server,3)) etc alias formtime {
var %a = $round($1,0)
var %s = $calc(%a % 60)
var %h = $int($calc(%a / 3600))
var %m = $int($calc(((%a - (%h * 3600))) / 60))
return $base(%h,10,10,2) $+ : $+ $base(%m,10,10,2) $+ : $+ $base(%s,10,10,2)
} I was wondering how to get that to return a format of 01:04:11:59 dd:hh:mm:ss thanks for any help. hmph, 1 line... Im not sure why your using $int/$base functions when $duration is all you need you even put it as your subject for topic. alias formtime return $duration($1,1)
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
|
|
|
|
Joined: Mar 2007
Posts: 218
Fjord artisan
|
OP
Fjord artisan
Joined: Mar 2007
Posts: 218 |
That's not helped me 1 iota I put Duration, not $duration in the subject. What you suggested still counts up
10secs.. 11secs.. 1min 10secs.. 1min 11secs..
That's why i said it does 04:11:59.. 04:12:00..
and i want it to look like. 00:04:11:59.. 00:04:12:00..
|
|
|
|
Joined: Dec 2002
Posts: 2,031
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,031 |
alias formtime {
var %a = $round($1,0)
var %s = $calc(%a % 60)
var %h = $int($calc(%a / 3600))
var %m = $int($calc(((%a - (%h * 3600))) / 60))
var %d = $int($calc(%h / 24))
var %h = $calc(%h - (%d * 24))
return $base(%d,10,10,2) $+ : $+ $base(%h,10,10,2) $+ : $+ $base(%m,10,10,2) $+ : $+ $base(%s,10,10,2)
}
|
|
|
|
Joined: Mar 2007
Posts: 218
Fjord artisan
|
OP
Fjord artisan
Joined: Mar 2007
Posts: 218 |
|
|
|
|
Joined: Nov 2006
Posts: 1,559
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
Alternatively, you could use $gmt and the known parameters of $asctime. The only pitfall is that "day" starts with one and not zero: alias timeformat {
; more than one day: subtract one day and use "dd"
if ($1 >= 86400) { return $gmt($calc($1 - $v2),dd:HH:nn:ss) }
; less then one day: fake "dd" with 00
else { return 00: $+ $gmt($1,HH:nn:ss) }
}
|
|
|
|
Joined: Aug 2007
Posts: 72
Babel fish
|
Babel fish
Joined: Aug 2007
Posts: 72 |
Post deleted by PhireCoder
mIRC Scripting: So easy a caveman could do it.
|
|
|
|
Joined: Dec 2002
Posts: 2,031
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,031 |
None of those do what the OP requested, and even fail at some points.
alias _duration {
; days:hours:minutes:seconds
var %d = $iif($int($calc($1 / 86400)),$v1,0),%s = $calc($1 - (%d * 86400))
var %h = $iif($int($calc(%s / 3600)),$v1,0),%s = $calc(%s - (%h * 3600))
var %m = $iif($int($calc(%s / 60)),$v1,0),%s = $calc(%s - (%m * 60))
return $+($base(%d,10,10,2),:,$base(%h,10,10,2),:,$base(%m,10,10,2),:,$base(%s,10,10,2))
}
alias _duration {
; weeks:days:hours:minutes:seconds
var %w = $iif($int($calc($1 / 604800)),$v1,0),%s = $calc($1 - (%w * 604800))
var %d = $iif($int($calc(%s / 86400)),$v1,0),%s = $calc(%s - (%d * 86400))
var %h = $iif($int($calc(%s / 3600)),$v1,0),%s = $calc(%s - (%h * 3600))
var %m = $iif($int($calc(%s / 60)),$v1,0),%s = $calc(%s - (%m * 60))
return $+($base(%w,10,10,2),:,$base(%d,10,10,2),:,$base(%h,10,10,2),:,$base(%m,10,10,2),:,$base(%s,10,10,2))
}
|
|
|
|
Joined: Aug 2007
Posts: 72
Babel fish
|
Babel fish
Joined: Aug 2007
Posts: 72 |
Heh, Yeah wasn't thinkin... OK, here's RoCk's examples Simplified:
;returns in dd:hh:mm:ss format
alias formtime return $gmt($1,$+($base($iif($int($calc($1 / 86400)),$v1,0),10,10,2),:HH:nn:ss))
;same as above with weeks added.. ww:dd:hh:mm format
alias formtime return $gmt($1,$+($base($iif($int($calc($1 / 604800)),$v1,0),10,10,4),:,$base($iif($int($calc(($1 - ($iif($int($calc($1 / 604800)),$v1,0) * 604800)) / 86400)),$v1,0),10,10,2),:HH:nn:ss))
Well not really simple but, ya know
mIRC Scripting: So easy a caveman could do it.
|
|
|
|
Joined: Dec 2002
Posts: 2,031
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,031 |
Those fail at 17753:04:03:14:08 or 10,737,418,240 seconds or approximately 340 years lol :p
Just messin' with ya .. well done.
|
|
|
|
|