mIRC Home    About    Download    Register    News    Help

Topic Options
#57697 - 26/10/03 04:26 PM A specified time + 1 secs. (Timer)
NRJ Offline
Babel fish

Registered: 02/03/03
Posts: 86
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

Top
#57698 - 26/10/03 04:52 PM Re: A specified time + 1 secs. (Timer)
pheonix Offline
Hoopy frood

Registered: 06/05/03
Posts: 2265
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
_________________________
new username: tidy_trax

Top
#57699 - 26/10/03 05:00 PM Re: A specified time + 1 secs. (Timer)
J0ke Offline
Vogon poet

Registered: 10/01/03
Posts: 150
Loc: Latvia, LV
//echo $time - $asctime($calc($ctime + 1),H:nn:ss)
_________________________
Go ahead, jump. 100,000 lemmings can't be wrong.

Top
#57700 - 26/10/03 05:21 PM Re: A specified time + 1 secs. (Timer)
NRJ Offline
Babel fish

Registered: 02/03/03
Posts: 86
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

Top
#57701 - 28/10/03 05:47 AM Re: A specified time + 1 secs. (Timer)
Iori Offline
Hoopy frood

Registered: 30/08/03
Posts: 1831
Ye gods. grin
Code:
alias mytime return $duration($calc($duration($$1)+1),3)

Top