mIRC Home    About    Download    Register    News    Help

Print Thread
#179699 26/06/07 10:04 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Hi All,

I'm looking for a way to calculate how many hours are between now and the first upcoming 11GMT.

To illustrate:
//echo -a $gmt($ctime,HH) return atm 22

Now it should calculate the amount of hours to the next 11GMT.
So, in this case I want the bot to return 12 (or 13 confused)

Basicly the bot should return how many hours are between NOW and the first coming 11GMT...

Any idea's?

Thx!

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
$calc($iif($gmt(HH) >= 11,24,0) + 11 - $gmt(HH))


Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Or
  • //echo -a $calc((24 - $gmt(HH) + 11) % 24)

Could also be written as $calc((35 - $gmt(HH)) % 24) but the first shows what's happening

deegee #179714 27/06/07 05:28 AM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Kewl!
Both versions work perfectly.

Thanks a lot guys!


Link Copied to Clipboard