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
I wont to calculate an actual time like this:

$calc($asctime(HH:nn:ss) - $ctime(30))

The 30 is in seconds and I want to know, what time is it here 30 seconds before the actual time. How can I calculate this?

Greets, Mathias

Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
$time($calc($ctime - 30))

Joined: Mar 2003
Posts: 86
N
NRJ Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Mar 2003
Posts: 86
thx smile

Mathias

Joined: Mar 2003
Posts: 86
N
NRJ Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Mar 2003
Posts: 86
mh, and how can I calculatate a special time like this?

Actual time: 18:00:00 (not $time, a variable time)
Time variance: 3secs
Right time: 18:00:03

I want to say to my script: Difference is +3secs and then the script calculatate it. How can I do this?

Greets, Mathias

Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
$time($calc($ctime($date 18:00:00) + 3))

If I understood you correctly then that will do the job..

Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
//echo -a $diff(12:00:00)
//echo -a $diff(17/04/2003 12:00:00)
Code:
alias diff {
  var %a = $ctime($iif($2,$1,$date) $iif($2,$2,$1))
  if %a > $ctime { return - $duration($calc(%a - $ctime)) }
  return + $duration($calc($ctime - %a))
}

Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
Code:
alias diff {
  var %a = $ctime($iif($2,$1-,$date $1))
  if %a > $ctime { return - $duration($calc(%a - $ctime)) }
  return + $duration($calc($ctime - %a))
}

Joined: Mar 2003
Posts: 86
N
NRJ Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Mar 2003
Posts: 86
cool ! thank you smile)


Link Copied to Clipboard