mIRC Homepage
Posted By: NRJ A specified time + 1 secs. (Timer) - 26/10/03 04:26 PM
How can I calculate a time like this:

Actual time: 17:00:00
Differenz: 1secs

After calculate: 17:00:01


I want to say mIRC e. g. 17:00:00 (not $asctime, it's a special time, that I say to mIRC) + 1secs, not more. But how can I do it?? smile


Mathias
Posted By: pheonix Re: A specified time + 1 secs. (Timer) - 26/10/03 04:52 PM
Code:
alias mytime {
  if ($right($time(HH:nn:ss),2) < 59) { return $left($time(HH:nn:ss),6) $+ $calc($right($time(HH:nn:ss),2) + 1) }
  else { return $left($time(HH:nn:ss),3) $+ $calc($mid($time(HH:nn:ss),4,2) + 1) $+ :00 }
}

$time = 16:54:55
$mytime = 16:54:56
$time = 16:54:59
$mytime = 16:55:00
//echo -a $time - $mytime
i tested it for once cool
Posted By: J0ke Re: A specified time + 1 secs. (Timer) - 26/10/03 05:00 PM
//echo $time - $asctime($calc($ctime + 1),H:nn:ss)
Posted By: NRJ Re: A specified time + 1 secs. (Timer) - 26/10/03 05:21 PM
mhhhhhhh, good! and I scripted this here at last:



alias mytime {
if ($right($1,2) < 59) && ($mid($1,4,2) < 59) {
if ($len($calc($right($1,2) + 1)) != 1) {
return $left($1,6) $+ $calc($right($1,2) + 1)
}

if ($len($calc($right($1,2) + 1)) == 1) {
return $left($1,6) $+ 0 $+ $calc($right($1,2) + 1)
}
}

if ($right($1,2) == 59) && ($mid($1,4,2) < 59) {
return $left($1,3) $+ $calc($mid($1,4,2) + 1) $+ :00
}

if ($right($1,2) < 59) && ($mid($1,4,2) == 59) {
if ($len($calc($right($1,2) + 1)) != 1) {
return $left($1,6) $+ $calc($right($1,2) + 1)
}

if ($len($calc($right($1,2) + 1)) == 1) {
return $left($1,6) $+ 0 $+ $calc($right($1,2) + 1)
}
}

if ($right($1,2) == 59) && ($mid($1,4,2) == 59) {
if ($calc($left($1,2) + 1) == 24) {
return 00:00:00
}

if ($len($calc($left($1,2) + 1)) == 1) {
return 0 $+ $calc($left($1,2) + 1) $+ :00:00
}

if ($len($calc($left($1,2) + 1)) != 1) {
return $calc($left($1,2) + 1) $+ :00:00
}
}
}


smile
Mathias
Posted By: Iori Re: A specified time + 1 secs. (Timer) - 28/10/03 05:47 AM
Ye gods. grin
Code:
alias mytime return $duration($calc($duration($$1)+1),3)
© mIRC Discussion Forums