mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2003
Posts: 86
N
NRJ Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Mar 2003
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

Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
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
Joined: Jan 2003
Posts: 150
J
Vogon poet
Offline
Vogon poet
J
Joined: Jan 2003
Posts: 150
//echo $time - $asctime($calc($ctime + 1),H:nn:ss)


Go ahead, jump. 100,000 lemmings can't be wrong.
Joined: Mar 2003
Posts: 86
N
NRJ Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Mar 2003
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

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Ye gods. grin
Code:
alias mytime return $duration($calc($duration($$1)+1),3)


Link Copied to Clipboard